A721765713BB9F7D0014DAAE /* referencedb.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A721765613BB9F7D0014DAAE /* referencedb.cpp */; };
A727864412E9E28C00F86ABA /* removerarecommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A727864312E9E28C00F86ABA /* removerarecommand.cpp */; };
A73DDBBA13C4A0D1006AAE38 /* clearmemorycommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A73DDBB913C4A0D1006AAE38 /* clearmemorycommand.cpp */; };
+ A73DDC3813C4BF64006AAE38 /* mothurmetastats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A73DDC3713C4BF64006AAE38 /* mothurmetastats.cpp */; };
A74D3687137DAB8300332B0C /* addtargets2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A74D3655137DAB8300332B0C /* addtargets2.cpp */; };
A74D3688137DAB8400332B0C /* alignchime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A74D3656137DAB8300332B0C /* alignchime.cpp */; };
A74D3689137DAB8400332B0C /* alignchimel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A74D3657137DAB8300332B0C /* alignchimel.cpp */; };
A7730EFF13967241007433A3 /* countseqscommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7730EFE13967241007433A3 /* countseqscommand.cpp */; };
A778FE6B134CA6CA00C0BA33 /* getcommandinfocommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A778FE6A134CA6CA00C0BA33 /* getcommandinfocommand.cpp */; };
A77A221F139001B600B0BE70 /* deuniquetreecommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A77A221E139001B600B0BE70 /* deuniquetreecommand.cpp */; };
+ A79234D713C74BF6002B08E2 /* mothurfisher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A79234D613C74BF6002B08E2 /* mothurfisher.cpp */; };
A799F5B91309A3E000AEEFA0 /* makefastqcommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A799F5B81309A3E000AEEFA0 /* makefastqcommand.cpp */; };
A7A61F2D130062E000E05B6B /* amovacommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7A61F2C130062E000E05B6B /* amovacommand.cpp */; };
A7E9B88112D37EC400DA6239 /* ace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7E9B64F12D37EC300DA6239 /* ace.cpp */; };
A727864312E9E28C00F86ABA /* removerarecommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = removerarecommand.cpp; sourceTree = "<group>"; };
A73DDBB813C4A0D1006AAE38 /* clearmemorycommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = clearmemorycommand.h; sourceTree = "<group>"; };
A73DDBB913C4A0D1006AAE38 /* clearmemorycommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = clearmemorycommand.cpp; sourceTree = "<group>"; };
+ A73DDC3613C4BF64006AAE38 /* mothurmetastats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mothurmetastats.h; sourceTree = "<group>"; };
+ A73DDC3713C4BF64006AAE38 /* mothurmetastats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = mothurmetastats.cpp; sourceTree = "<group>"; };
A74D3655137DAB8300332B0C /* addtargets2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = addtargets2.cpp; sourceTree = "<group>"; };
A74D3656137DAB8300332B0C /* alignchime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = alignchime.cpp; sourceTree = "<group>"; };
A74D3657137DAB8300332B0C /* alignchimel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = alignchimel.cpp; sourceTree = "<group>"; };
A778FE6A134CA6CA00C0BA33 /* getcommandinfocommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = getcommandinfocommand.cpp; sourceTree = "<group>"; };
A77A221D139001B600B0BE70 /* deuniquetreecommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = deuniquetreecommand.h; sourceTree = "<group>"; };
A77A221E139001B600B0BE70 /* deuniquetreecommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = deuniquetreecommand.cpp; sourceTree = "<group>"; };
+ A79234D513C74BF6002B08E2 /* mothurfisher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mothurfisher.h; sourceTree = "<group>"; };
+ A79234D613C74BF6002B08E2 /* mothurfisher.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = mothurfisher.cpp; sourceTree = "<group>"; };
A799F5B71309A3E000AEEFA0 /* makefastqcommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = makefastqcommand.h; sourceTree = "<group>"; };
A799F5B81309A3E000AEEFA0 /* makefastqcommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = makefastqcommand.cpp; sourceTree = "<group>"; };
A7A61F1A130035C800E05B6B /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; };
A7E9B6E612D37EC400DA6239 /* fisher2.h */,
A7E9B75512D37EC400DA6239 /* metastats.h */,
A7E9B75612D37EC400DA6239 /* metastats2.c */,
+ A79234D513C74BF6002B08E2 /* mothurfisher.h */,
+ A79234D613C74BF6002B08E2 /* mothurfisher.cpp */,
+ A73DDC3613C4BF64006AAE38 /* mothurmetastats.h */,
+ A73DDC3713C4BF64006AAE38 /* mothurmetastats.cpp */,
);
name = metastats;
sourceTree = "<group>";
A7730EFF13967241007433A3 /* countseqscommand.cpp in Sources */,
A721765713BB9F7D0014DAAE /* referencedb.cpp in Sources */,
A73DDBBA13C4A0D1006AAE38 /* clearmemorycommand.cpp in Sources */,
+ A73DDC3813C4BF64006AAE38 /* mothurmetastats.cpp in Sources */,
+ A79234D713C74BF6002B08E2 /* mothurfisher.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
//MPI_Info info;
//MPI_File_delete(outAccnosFilename, info);
hasAccnos = false;
- remove(accnosFileName.c_str());
+ m->mothurRemove(accnosFileName);
}
}
numFastaSeqs = driver(lines[0], alignFileName, reportFileName, accnosFileName, candidateFileNames[s]);
#endif
- if (m->control_pressed) { remove(accnosFileName.c_str()); remove(alignFileName.c_str()); remove(reportFileName.c_str()); outputTypes.clear(); return 0; }
+ if (m->control_pressed) { m->mothurRemove(accnosFileName); m->mothurRemove(alignFileName); m->mothurRemove(reportFileName); outputTypes.clear(); return 0; }
//delete accnos file if its blank else report to user
- if (m->isBlank(accnosFileName)) { remove(accnosFileName.c_str()); hasAccnos = false; }
+ if (m->isBlank(accnosFileName)) { m->mothurRemove(accnosFileName); hasAccnos = false; }
else {
m->mothurOut("Some of you sequences generated alignments that eliminated too many bases, a list is provided in " + accnosFileName + ".");
if (!flip) {
vector<string> nonBlankAccnosFiles;
if (!(m->isBlank(accnosFName))) { nonBlankAccnosFiles.push_back(accnosFName); }
- else { remove(accnosFName.c_str()); } //remove so other files can be renamed to it
+ else { m->mothurRemove(accnosFName); } //remove so other files can be renamed to it
for (int i = 0; i < processIDS.size(); i++) {
ifstream in;
string tempFile = alignFileName + 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);
appendAlignFiles((alignFileName + toString(processIDS[i]) + ".temp"), alignFileName);
- remove((alignFileName + toString(processIDS[i]) + ".temp").c_str());
+ m->mothurRemove((alignFileName + toString(processIDS[i]) + ".temp"));
appendReportFiles((reportFileName + toString(processIDS[i]) + ".temp"), reportFileName);
- remove((reportFileName + toString(processIDS[i]) + ".temp").c_str());
+ m->mothurRemove((reportFileName + toString(processIDS[i]) + ".temp"));
if (!(m->isBlank(accnosFName + toString(processIDS[i]) + ".temp"))) {
nonBlankAccnosFiles.push_back(accnosFName + toString(processIDS[i]) + ".temp");
- }else { remove((accnosFName + toString(processIDS[i]) + ".temp").c_str()); }
+ }else { m->mothurRemove((accnosFName + toString(processIDS[i]) + ".temp")); }
}
for (int h=1; h < nonBlankAccnosFiles.size(); h++) {
appendAlignFiles(nonBlankAccnosFiles[h], accnosFName);
- remove(nonBlankAccnosFiles[h].c_str());
+ m->mothurRemove(nonBlankAccnosFiles[h]);
}
}else { //recreate the accnosfile if needed
ofstream out;
generateDatabaseAndNames(tfile, tempFile, method, ksize, 0.0, 0.0, 0.0, 0.0);
//prevents errors caused by creating shortcut files if you had an error in the sanity check.
- if (m->control_pressed) { remove(phyloTreeName.c_str()); remove(probFileName.c_str()); remove(probFileName2.c_str()); }
+ if (m->control_pressed) { m->mothurRemove(phyloTreeName); m->mothurRemove(probFileName); m->mothurRemove(probFileName2); }
else{
genusNodes = phyloTree->getGenusNodes();
genusTotals = phyloTree->getGenusTotals();
for (int j = 0; j < numSeqs; j++) {
- if (m->control_pressed) { outTemp.close(); remove(file.c_str()); return 0; }
+ if (m->control_pressed) { outTemp.close(); m->mothurRemove(file); return 0; }
outTemp << pref[i][j].name << '\t' << pref[i][j].leftParent << '\t' << pref[i][j].rightParent << '\t';
outTemp << pref[i][j].score << '\t' << pref[i][j].closestLeft << '\t' << pref[i][j].closestRight << '\t' << pref[i][j].midpoint << endl;
for (int j = 0; j < numSeqs; j++) {
- if (m->control_pressed) { inTemp.close(); remove(file.c_str()); return 0; }
+ if (m->control_pressed) { inTemp.close(); m->mothurRemove(file); return 0; }
inTemp >> pref[i][j].name >> pref[i][j].leftParent >> pref[i][j].rightParent;
inTemp >> pref[i][j].score >> pref[i][j].closestLeft >> pref[i][j].closestRight >> pref[i][j].midpoint;
inTemp.close();
- remove(file.c_str());
+ m->mothurRemove(file);
return 0;
}
while((list != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
- if(m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } delete input; delete fasta; if (groupfile != "") { delete groupMap; } return 0; }
+ if(m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } delete input; delete fasta; if (groupfile != "") { delete groupMap; } return 0; }
if(allLines == 1 || labels.count(list->getLabel()) == 1){
error = process(list);
- if (error == 1) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } delete input; delete fasta; if (groupfile != "") { delete groupMap; } return 0; }
+ if (error == 1) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } delete input; delete fasta; if (groupfile != "") { delete groupMap; } return 0; }
processedLabels.insert(list->getLabel());
userLabels.erase(list->getLabel());
list = input->getListVector(lastLabel);
error = process(list);
- if (error == 1) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } delete input; delete fasta; if (groupfile != "") { delete groupMap; } return 0; }
+ if (error == 1) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } delete input; delete fasta; if (groupfile != "") { delete groupMap; } return 0; }
processedLabels.insert(list->getLabel());
userLabels.erase(list->getLabel());
list = input->getListVector();
}
- if(m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } delete input; delete fasta; if (groupfile != "") { delete groupMap; } return 0; }
+ if(m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } delete input; delete fasta; if (groupfile != "") { delete groupMap; } return 0; }
//output error messages about any remaining user labels
set<string>::iterator it;
list = input->getListVector(lastLabel);
error = process(list);
- if (error == 1) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } delete input; delete fasta; if (groupfile != "") { delete groupMap; } return 0; }
+ if (error == 1) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } delete input; delete fasta; if (groupfile != "") { delete groupMap; } return 0; }
delete list;
}
delete fasta;
if (groupfile != "") { delete groupMap; }
- if(m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if(m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
//**************************************************************************************************/
BlastAlignment::~BlastAlignment(){ // The desctructor should clean up by removing the temporary
- remove(candidateFileName.c_str()); // files used to run bl2seq
- remove(templateFileName.c_str());
- remove(blastFileName.c_str());
+ m->mothurRemove(candidateFileName); // files used to run bl2seq
+ m->mothurRemove(templateFileName);
+ m->mothurRemove(blastFileName);
}
//**************************************************************************************************/
BlastDB::~BlastDB(){
try{
- remove(queryFileName.c_str()); // let's clean stuff up and remove the temp files
- remove(dbFileName.c_str()); // let's clean stuff up and remove the temp files
- remove((dbFileName+".nsq").c_str()); // let's clean stuff up and remove the temp files
- remove((dbFileName+".nsi").c_str()); // let's clean stuff up and remove the temp files
- remove((dbFileName+".nsd").c_str()); // let's clean stuff up and remove the temp files
- remove((dbFileName+".nin").c_str()); // let's clean stuff up and remove the temp files
- remove((dbFileName+".nhr").c_str()); // let's clean stuff up and remove the temp files
- remove(blastFileName.c_str()); // let's clean stuff up and remove the temp files
+ m->mothurRemove(queryFileName); // let's clean stuff up and remove the temp files
+ m->mothurRemove(dbFileName); // let's clean stuff up and remove the temp files
+ m->mothurRemove((dbFileName+".nsq")); // let's clean stuff up and remove the temp files
+ m->mothurRemove((dbFileName+".nsi")); // let's clean stuff up and remove the temp files
+ m->mothurRemove((dbFileName+".nsd")); // let's clean stuff up and remove the temp files
+ m->mothurRemove((dbFileName+".nin")); // let's clean stuff up and remove the temp files
+ m->mothurRemove((dbFileName+".nhr")); // let's clean stuff up and remove the temp files
+ m->mothurRemove(blastFileName.c_str()); // let's clean stuff up and remove the temp files
}
catch(exception& e) {
m->errorOut(e, "BlastDB", "~BlastDB");
topMatches.push_back(templateAccession);
}
m8FileHandle.close();
- remove((queryFileName+pid+toString(randNumber)).c_str());
- remove((blastFileName+pid+toString(randNumber)).c_str());
+ m->mothurRemove((queryFileName+pid+toString(randNumber)));
+ m->mothurRemove((blastFileName+pid+toString(randNumber)));
return topMatches;
}
//cout << templateAccession << endl;
}
m8FileHandle.close();
- remove((queryFileName+pid+toString(randNumber)).c_str());
- remove((blastFileName+pid+toString(randNumber)).c_str());
+ m->mothurRemove((queryFileName+pid+toString(randNumber)));
+ m->mothurRemove((blastFileName+pid+toString(randNumber)));
//cout << "\n" ;
return topMatches;
}
globaldata->gTreemap = tmap;
while((order != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } globaldata->Groups.clear(); delete input;delete util; return 0; }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } globaldata->Groups.clear(); delete input;delete util; return 0; }
if(allLines == 1 || labels.count(order->getLabel()) == 1){
m->mothurOut(order->getLabel()); m->mothurOutEndLine();
int error = process(order);
- if (error == 1) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } globaldata->Groups.clear(); delete input;delete util; return 0; }
+ if (error == 1) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } globaldata->Groups.clear(); delete input;delete util; return 0; }
processedLabels.insert(order->getLabel());
userLabels.erase(order->getLabel());
order = input->getSharedOrderVector(lastLabel);
m->mothurOut(order->getLabel()); m->mothurOutEndLine();
int error = process(order);
- if (error == 1) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } globaldata->Groups.clear(); delete input;delete util; return 0; }
+ if (error == 1) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } globaldata->Groups.clear(); delete input;delete util; return 0; }
processedLabels.insert(order->getLabel());
userLabels.erase(order->getLabel());
}
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } globaldata->Groups.clear(); delete input; delete util; return 0; }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } globaldata->Groups.clear(); delete input; delete util; return 0; }
//output error messages about any remaining user labels
set<string>::iterator it;
}
}
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } globaldata->Groups.clear(); delete input; delete util; return 0; }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } globaldata->Groups.clear(); delete input; delete util; return 0; }
//run last line if you need to
if (needToRun == true) {
order = input->getSharedOrderVector(lastLabel);
m->mothurOut(order->getLabel()); m->mothurOutEndLine();
int error = process(order);
- if (error == 1) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } globaldata->Groups.clear(); delete input; delete util; return 0; }
+ if (error == 1) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } globaldata->Groups.clear(); delete input; delete util; return 0; }
delete order;
}
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } globaldata->Groups.clear();delete input; delete util; return 0; }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } globaldata->Groups.clear();delete input; delete util; return 0; }
//reset groups parameter
globaldata->Groups.clear();
//run catchall
system(catchAllCommand.c_str());
- remove(filename.c_str());
+ m->mothurRemove(filename);
filename = m->getRootName(filename); filename = filename.substr(0, filename.length()-1); //rip off extra .
if (savedOutputDir == "") { filename = m->getSimpleName(filename); }
createSummaryFile(filename + "_BestModelsAnalysis.csv", sabund->getLabel(), out);
- if (m->control_pressed) { out.close(); for (int i = 0; i < outputNames.size(); i++) {remove(outputNames[i].c_str()); } delete input; delete sabund; return 0; }
+ if (m->control_pressed) { out.close(); for (int i = 0; i < outputNames.size(); i++) {m->mothurRemove(outputNames[i]); } delete input; delete sabund; return 0; }
processedLabels.insert(sabund->getLabel());
userLabels.erase(sabund->getLabel());
//run catchall
system(catchAllCommand.c_str());
- remove(filename.c_str());
+ m->mothurRemove(filename);
filename = m->getRootName(filename); filename = filename.substr(0, filename.length()-1); //rip off extra .
if (savedOutputDir == "") { filename = m->getSimpleName(filename); }
createSummaryFile(filename + "_BestModelsAnalysis.csv", sabund->getLabel(), out);
- if (m->control_pressed) { out.close(); for (int i = 0; i < outputNames.size(); i++) {remove(outputNames[i].c_str()); } delete input; delete sabund; return 0; }
+ if (m->control_pressed) { out.close(); for (int i = 0; i < outputNames.size(); i++) {m->mothurRemove(outputNames[i]); } delete input; delete sabund; return 0; }
processedLabels.insert(sabund->getLabel());
userLabels.erase(sabund->getLabel());
//run catchall
system(catchAllCommand.c_str());
- remove(filename.c_str());
+ m->mothurRemove(filename);
filename = m->getRootName(filename); filename = filename.substr(0, filename.length()-1); //rip off extra .
if (savedOutputDir == "") { filename = m->getSimpleName(filename); }
out.close();
delete input;
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) {remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) {m->mothurRemove(outputNames[i]); } return 0; }
}
numLines = thisFilesLines.size();
temp.close();
- remove(outputNames[i].c_str());
+ m->mothurRemove(outputNames[i]);
}
//for each label
//clears file before we start to write to it below
for (int i=0; i<lookup.size(); i++) {
- remove((sharedFileRoot + lookup[i]->getGroup() + ".sabund").c_str());
+ m->mothurRemove((sharedFileRoot + lookup[i]->getGroup() + ".sabund"));
filenames.push_back((sharedFileRoot + lookup[i]->getGroup() + ".sabund"));
groups.push_back(lookup[i]->getGroup());
}
chimera->getChimeras();
- if (m->control_pressed) { delete chimera; for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear(); return 0; }
+ if (m->control_pressed) { delete chimera; for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear(); return 0; }
#ifdef USE_MPI
MPI_File outMPI;
#endif
- if (m->control_pressed) { remove(accnosFileName.c_str()); remove(outputFileName.c_str()); for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear(); delete chimera; return 0; }
+ if (m->control_pressed) { m->mothurRemove(accnosFileName); m->mothurRemove(outputFileName); for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear(); delete chimera; return 0; }
m->mothurOutEndLine(); m->mothurOut("It took " + toString(time(NULL) - start) + " secs to check " + toString(numSeqs) + " sequences."); m->mothurOutEndLine(); m->mothurOutEndLine();
string mapInfo = outputDir + m->getRootName(m->getSimpleName(fastaFileNames[s])) + "mapinfo";
- if (m->control_pressed) { delete chimera; for (int j = 0; j < outputNames.size(); j++) { remove(outputNames[j].c_str()); } outputTypes.clear(); return 0; }
+ if (m->control_pressed) { delete chimera; for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } outputTypes.clear(); return 0; }
#ifdef USE_MPI
MPI_File_open(MPI_COMM_WORLD, outFilename, outMode, MPI_INFO_NULL, &outMPI);
MPI_File_open(MPI_COMM_WORLD, outAccnosFilename, outMode, MPI_INFO_NULL, &outMPIAccnos);
- if (m->control_pressed) { MPI_File_close(&inMPI); MPI_File_close(&outMPI); MPI_File_close(&outMPIAccnos); for (int j = 0; j < outputNames.size(); j++) { remove(outputNames[j].c_str()); } outputTypes.clear(); delete chimera; return 0; }
+ if (m->control_pressed) { MPI_File_close(&inMPI); MPI_File_close(&outMPI); MPI_File_close(&outMPIAccnos); for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } outputTypes.clear(); delete chimera; return 0; }
if (pid == 0) { //you are the root process
string outTemp = "For full window mapping info refer to " + mapInfo + "\n";
//align your part
driverMPI(startIndex, numSeqsPerProcessor, inMPI, outMPI, outMPIAccnos, MPIPos);
- if (m->control_pressed) { MPI_File_close(&inMPI); MPI_File_close(&outMPI); MPI_File_close(&outMPIAccnos); remove(outputFileName.c_str()); remove(accnosFileName.c_str()); for (int j = 0; j < outputNames.size(); j++) { remove(outputNames[j].c_str()); } outputTypes.clear(); delete chimera; return 0; }
+ if (m->control_pressed) { MPI_File_close(&inMPI); MPI_File_close(&outMPI); MPI_File_close(&outMPIAccnos); m->mothurRemove(outputFileName); m->mothurRemove(accnosFileName); for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } outputTypes.clear(); delete chimera; return 0; }
}else{ //you are a child process
MPI_Recv(&numSeqs, 1, MPI_INT, 0, tag, MPI_COMM_WORLD, &status);
//align your part
driverMPI(startIndex, numSeqsPerProcessor, inMPI, outMPI, outMPIAccnos, MPIPos);
- if (m->control_pressed) { MPI_File_close(&inMPI); MPI_File_close(&outMPI); MPI_File_close(&outMPIAccnos); for (int j = 0; j < outputNames.size(); j++) { remove(outputNames[j].c_str()); } outputTypes.clear(); delete chimera; return 0; }
+ if (m->control_pressed) { MPI_File_close(&inMPI); MPI_File_close(&outMPI); MPI_File_close(&outMPIAccnos); for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } outputTypes.clear(); delete chimera; return 0; }
}
//close files
numSeqs = driver(lines[0], outputFileName, fastaFileNames[s], accnosFileName);
- if (m->control_pressed) { remove(outputFileName.c_str()); remove(tempHeader.c_str()); remove(accnosFileName.c_str()); for (int j = 0; j < outputNames.size(); j++) { remove(outputNames[j].c_str()); } for (int i = 0; i < lines.size(); i++) { delete lines[i]; } outputTypes.clear(); lines.clear(); delete chimera; return 0; }
+ if (m->control_pressed) { m->mothurRemove(outputFileName); m->mothurRemove(tempHeader); m->mothurRemove(accnosFileName); for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } for (int i = 0; i < lines.size(); i++) { delete lines[i]; } outputTypes.clear(); lines.clear(); delete chimera; return 0; }
}else{
processIDS.resize(0);
//append output files
for(int i=1;i<processors;i++){
m->appendFiles((outputFileName + toString(processIDS[i]) + ".temp"), outputFileName);
- remove((outputFileName + toString(processIDS[i]) + ".temp").c_str());
+ m->mothurRemove((outputFileName + toString(processIDS[i]) + ".temp"));
}
//append output files
for(int i=1;i<processors;i++){
m->appendFiles((accnosFileName + toString(processIDS[i]) + ".temp"), accnosFileName);
- remove((accnosFileName + toString(processIDS[i]) + ".temp").c_str());
+ m->mothurRemove((accnosFileName + toString(processIDS[i]) + ".temp"));
}
if (m->control_pressed) {
- remove(outputFileName.c_str());
- remove(accnosFileName.c_str());
- for (int j = 0; j < outputNames.size(); j++) { remove(outputNames[j].c_str()); } outputTypes.clear();
+ m->mothurRemove(outputFileName);
+ m->mothurRemove(accnosFileName);
+ for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } outputTypes.clear();
for (int i = 0; i < lines.size(); i++) { delete lines[i]; } lines.clear();
delete chimera;
return 0;
#else
numSeqs = driver(lines[0], outputFileName, fastaFileNames[s], accnosFileName);
- if (m->control_pressed) { remove(outputFileName.c_str()); remove(tempHeader.c_str()); remove(accnosFileName.c_str()); for (int j = 0; j < outputNames.size(); j++) { remove(outputNames[j].c_str()); } for (int i = 0; i < lines.size(); i++) { delete lines[i]; } outputTypes.clear(); lines.clear(); delete chimera; return 0; }
+ if (m->control_pressed) { m->mothurRemove(outputFileName); m->mothurRemove(tempHeader); m->mothurRemove(accnosFileName); for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } for (int i = 0; i < lines.size(); i++) { delete lines[i]; } outputTypes.clear(); lines.clear(); delete chimera; return 0; }
#endif
m->appendFiles(outputFileName, tempHeader);
- remove(outputFileName.c_str());
+ m->mothurRemove(outputFileName);
rename(tempHeader.c_str(), outputFileName.c_str());
#endif
string tempFile = outputFileName + 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;
MPI_File_open(MPI_COMM_WORLD, inFileName, inMode, MPI_INFO_NULL, &inMPI); //comm, filename, mode, info, filepointer
MPI_File_open(MPI_COMM_WORLD, outFilename, outMode, MPI_INFO_NULL, &outMPI);
- if (m->control_pressed) { MPI_File_close(&inMPI); MPI_File_close(&outMPI); for (int j = 0; j < outputNames.size(); j++) { remove(outputNames[j].c_str()); } outputTypes.clear(); delete chimera; return 0; }
+ if (m->control_pressed) { MPI_File_close(&inMPI); MPI_File_close(&outMPI); for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } outputTypes.clear(); delete chimera; return 0; }
if (pid == 0) { //you are the root process
MPIPos = m->setFilePosFasta(fastaFileNames[i], numSeqs); //fills MPIPos, returns numSeqs
//align your part
driverMPI(startIndex, numSeqsPerProcessor, inMPI, outMPI, MPIPos);
- if (m->control_pressed) { MPI_File_close(&inMPI); MPI_File_close(&outMPI); for (int j = 0; j < outputNames.size(); j++) { remove(outputNames[j].c_str()); } outputTypes.clear(); delete chimera; return 0; }
+ if (m->control_pressed) { MPI_File_close(&inMPI); MPI_File_close(&outMPI); for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } outputTypes.clear(); delete chimera; return 0; }
//wait on chidren
for(int j = 1; j < processors; j++) {
//align your part
driverMPI(startIndex, numSeqsPerProcessor, inMPI, outMPI, MPIPos);
- if (m->control_pressed) { MPI_File_close(&inMPI); MPI_File_close(&outMPI); for (int j = 0; j < outputNames.size(); j++) { remove(outputNames[j].c_str()); } outputTypes.clear(); delete chimera; return 0; }
+ if (m->control_pressed) { MPI_File_close(&inMPI); MPI_File_close(&outMPI); for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } outputTypes.clear(); delete chimera; return 0; }
//tell parent you are done.
char buf[5];
if(processors == 1){
numSeqs = driver(lines[0], outputFileName, fastaFileNames[i]);
- if (m->control_pressed) { for (int j = 0; j < outputNames.size(); j++) { remove(outputNames[j].c_str()); } for (int j = 0; j < lines.size(); j++) { delete lines[j]; } outputTypes.clear(); lines.clear(); delete chimera; return 0; }
+ if (m->control_pressed) { for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } for (int j = 0; j < lines.size(); j++) { delete lines[j]; } outputTypes.clear(); lines.clear(); delete chimera; return 0; }
}else{
processIDS.resize(0);
//append output files
for(int j=1;j<processors;j++){
m->appendFiles((outputFileName + toString(processIDS[j]) + ".temp"), outputFileName);
- remove((outputFileName + toString(processIDS[j]) + ".temp").c_str());
+ m->mothurRemove((outputFileName + toString(processIDS[j]) + ".temp"));
}
if (m->control_pressed) {
- for (int j = 0; j < outputNames.size(); j++) { remove(outputNames[j].c_str()); } outputTypes.clear();
+ for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } outputTypes.clear();
for (int j = 0; j < lines.size(); j++) { delete lines[j]; } lines.clear();
delete chimera;
return 0;
#else
numSeqs = driver(lines[0], outputFileName, fastaFileNames[i]);
- if (m->control_pressed) { for (int j = 0; j < lines.size(); j++) { delete lines[j]; } lines.clear(); for (int j = 0; j < outputNames.size(); j++) { remove(outputNames[j].c_str()); } outputTypes.clear(); delete chimera; return 0; }
+ if (m->control_pressed) { for (int j = 0; j < lines.size(); j++) { delete lines[j]; } lines.clear(); for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } outputTypes.clear(); delete chimera; return 0; }
#endif
#endif
delete chimera;
string tempFile = outputFileName + 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;
accnosFileName = outputDir + m->getRootName(m->getSimpleName(fastaFileNames[s])) + "pintail.accnos";
}
- if (m->control_pressed) { delete chimera; for (int j = 0; j < outputNames.size(); j++) { remove(outputNames[j].c_str()); } return 0; }
+ if (m->control_pressed) { delete chimera; for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } return 0; }
if (chimera->getUnaligned()) {
m->mothurOut("Your template sequences are different lengths, please correct."); m->mothurOutEndLine();
MPI_File_open(MPI_COMM_WORLD, outFilename, outMode, MPI_INFO_NULL, &outMPI);
MPI_File_open(MPI_COMM_WORLD, outAccnosFilename, outMode, MPI_INFO_NULL, &outMPIAccnos);
- if (m->control_pressed) { outputTypes.clear(); MPI_File_close(&inMPI); MPI_File_close(&outMPI); MPI_File_close(&outMPIAccnos); for (int j = 0; j < outputNames.size(); j++) { remove(outputNames[j].c_str()); } delete chimera; return 0; }
+ if (m->control_pressed) { outputTypes.clear(); MPI_File_close(&inMPI); MPI_File_close(&outMPI); MPI_File_close(&outMPIAccnos); for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } delete chimera; return 0; }
if (pid == 0) { //you are the root process
//do your part
driverMPI(startIndex, numSeqsPerProcessor, inMPI, outMPI, outMPIAccnos, MPIPos);
- if (m->control_pressed) { outputTypes.clear(); MPI_File_close(&inMPI); MPI_File_close(&outMPI); MPI_File_close(&outMPIAccnos); remove(outputFileName.c_str()); remove(accnosFileName.c_str()); for (int j = 0; j < outputNames.size(); j++) { remove(outputNames[j].c_str()); } delete chimera; return 0; }
+ if (m->control_pressed) { outputTypes.clear(); MPI_File_close(&inMPI); MPI_File_close(&outMPI); MPI_File_close(&outMPIAccnos); m->mothurRemove(outputFileName); m->mothurRemove(accnosFileName); for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } delete chimera; return 0; }
}else{ //you are a child process
MPI_Recv(&numSeqs, 1, MPI_INT, 0, tag, MPI_COMM_WORLD, &status);
//do your part
driverMPI(startIndex, numSeqsPerProcessor, inMPI, outMPI, outMPIAccnos, MPIPos);
- if (m->control_pressed) { outputTypes.clear(); MPI_File_close(&inMPI); MPI_File_close(&outMPI); MPI_File_close(&outMPIAccnos); for (int j = 0; j < outputNames.size(); j++) { remove(outputNames[j].c_str()); } delete chimera; return 0; }
+ if (m->control_pressed) { outputTypes.clear(); MPI_File_close(&inMPI); MPI_File_close(&outMPI); MPI_File_close(&outMPIAccnos); for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } delete chimera; return 0; }
}
//close files
numSeqs = driver(lines[0], outputFileName, fastaFileNames[s], accnosFileName);
- if (m->control_pressed) { outputTypes.clear(); remove(outputFileName.c_str()); remove(accnosFileName.c_str()); for (int j = 0; j < outputNames.size(); j++) { remove(outputNames[j].c_str()); } for (int i = 0; i < lines.size(); i++) { delete lines[i]; } lines.clear(); delete chimera; return 0; }
+ if (m->control_pressed) { outputTypes.clear(); m->mothurRemove(outputFileName); m->mothurRemove(accnosFileName); for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } for (int i = 0; i < lines.size(); i++) { delete lines[i]; } lines.clear(); delete chimera; return 0; }
}else{
processIDS.resize(0);
//append output files
for(int i=1;i<processors;i++){
m->appendFiles((outputFileName + toString(processIDS[i]) + ".temp"), outputFileName);
- remove((outputFileName + toString(processIDS[i]) + ".temp").c_str());
+ m->mothurRemove((outputFileName + toString(processIDS[i]) + ".temp"));
}
//append output files
for(int i=1;i<processors;i++){
m->appendFiles((accnosFileName + toString(processIDS[i]) + ".temp"), accnosFileName);
- remove((accnosFileName + toString(processIDS[i]) + ".temp").c_str());
+ m->mothurRemove((accnosFileName + toString(processIDS[i]) + ".temp"));
}
if (m->control_pressed) {
- remove(outputFileName.c_str());
- remove(accnosFileName.c_str());
- for (int j = 0; j < outputNames.size(); j++) { remove(outputNames[j].c_str()); } outputTypes.clear();
+ m->mothurRemove(outputFileName);
+ m->mothurRemove(accnosFileName);
+ for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } outputTypes.clear();
for (int i = 0; i < lines.size(); i++) { delete lines[i]; } lines.clear();
delete chimera;
return 0;
#else
numSeqs = driver(lines[0], outputFileName, fastaFileNames[s], accnosFileName);
- if (m->control_pressed) { outputTypes.clear(); remove(outputFileName.c_str()); remove(accnosFileName.c_str()); for (int j = 0; j < outputNames.size(); j++) { remove(outputNames[j].c_str()); } for (int i = 0; i < lines.size(); i++) { delete lines[i]; } lines.clear(); delete chimera; return 0; }
+ if (m->control_pressed) { outputTypes.clear(); m->mothurRemove(outputFileName); m->mothurRemove(accnosFileName); for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } for (int i = 0; i < lines.size(); i++) { delete lines[i]; } lines.clear(); delete chimera; return 0; }
#endif
#endif
string tempFile = outputFileName + 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;
map<string, int> priority = sortFastaFile(fastaFileNames[s], nameFile);
m->mothurOut("Done."); m->mothurOutEndLine();
- if (m->control_pressed) { for (int j = 0; j < outputNames.size(); j++) { remove(outputNames[j].c_str()); } return 0; }
+ if (m->control_pressed) { for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } return 0; }
chimera = new ChimeraSlayer(fastaFileNames[s], templatefile, trim, priority, search, ksize, match, mismatch, window, divR, minSimilarity, minCoverage, minBS, minSNP, parents, iters, increment, numwanted, realign);
}
string accnosFileName = outputDir + m->getRootName(m->getSimpleName(fastaFileNames[s])) + "slayer.accnos";
string trimFastaFileName = outputDir + m->getRootName(m->getSimpleName(fastaFileNames[s])) + "slayer.fasta";
- if (m->control_pressed) { delete chimera; for (int j = 0; j < outputNames.size(); j++) { remove(outputNames[j].c_str()); } return 0; }
+ if (m->control_pressed) { delete chimera; for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } return 0; }
if (chimera->getUnaligned()) {
m->mothurOut("Your template sequences are different lengths, please correct."); m->mothurOutEndLine();
MPI_File_open(MPI_COMM_WORLD, outAccnosFilename, outMode, MPI_INFO_NULL, &outMPIAccnos);
if (trim) { MPI_File_open(MPI_COMM_WORLD, outFastaFilename, outMode, MPI_INFO_NULL, &outMPIFasta); }
- if (m->control_pressed) { outputTypes.clear(); MPI_File_close(&inMPI); MPI_File_close(&outMPI); if (trim) { MPI_File_close(&outMPIFasta); } MPI_File_close(&outMPIAccnos); for (int j = 0; j < outputNames.size(); j++) { remove(outputNames[j].c_str()); } delete chimera; return 0; }
+ if (m->control_pressed) { outputTypes.clear(); MPI_File_close(&inMPI); MPI_File_close(&outMPI); if (trim) { MPI_File_close(&outMPIFasta); } MPI_File_close(&outMPIAccnos); for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } delete chimera; return 0; }
if (pid == 0) { //you are the root process
m->mothurOutEndLine();
if (numSeqs == numNoParents) { m->mothurOut("[WARNING]: megablast returned 0 potential parents for all your sequences. This could be due to formatdb.exe not being setup properly, please check formatdb.log for errors."); m->mothurOutEndLine(); }
- if (m->control_pressed) { outputTypes.clear(); MPI_File_close(&inMPI); MPI_File_close(&outMPI); if (trim) { MPI_File_close(&outMPIFasta); } MPI_File_close(&outMPIAccnos); for (int j = 0; j < outputNames.size(); j++) { remove(outputNames[j].c_str()); } remove(outputFileName.c_str()); remove(accnosFileName.c_str()); delete chimera; return 0; }
+ if (m->control_pressed) { outputTypes.clear(); MPI_File_close(&inMPI); MPI_File_close(&outMPI); if (trim) { MPI_File_close(&outMPIFasta); } MPI_File_close(&outMPIAccnos); for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } m->mothurRemove(outputFileName); m->mothurRemove(accnosFileName); delete chimera; return 0; }
}else{ //you are a child process
if (templatefile != "self") { //if template=self we can only use 1 processor
int numNoParents = chimera->getNumNoParents();
MPI_Send(&numNoParents, 1, MPI_INT, 0, tag, MPI_COMM_WORLD);
- if (m->control_pressed) { outputTypes.clear(); MPI_File_close(&inMPI); MPI_File_close(&outMPI); if (trim) { MPI_File_close(&outMPIFasta); } MPI_File_close(&outMPIAccnos); for (int j = 0; j < outputNames.size(); j++) { remove(outputNames[j].c_str()); } delete chimera; return 0; }
+ if (m->control_pressed) { outputTypes.clear(); MPI_File_close(&inMPI); MPI_File_close(&outMPI); if (trim) { MPI_File_close(&outMPIFasta); } MPI_File_close(&outMPIAccnos); for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } delete chimera; return 0; }
}
}
int numNoParents = chimera->getNumNoParents();
if (numNoParents == numSeqs) { m->mothurOut("[WARNING]: megablast returned 0 potential parents for all your sequences. This could be due to formatdb.exe not being setup properly, please check formatdb.log for errors."); m->mothurOutEndLine(); }
- if (m->control_pressed) { outputTypes.clear(); if (trim) { remove(trimFastaFileName.c_str()); } remove(outputFileName.c_str()); remove(tempHeader.c_str()); remove(accnosFileName.c_str()); for (int j = 0; j < outputNames.size(); j++) { remove(outputNames[j].c_str()); } for (int i = 0; i < lines.size(); i++) { delete lines[i]; } lines.clear(); delete chimera; return 0; }
+ if (m->control_pressed) { outputTypes.clear(); if (trim) { m->mothurRemove(trimFastaFileName); } m->mothurRemove(outputFileName); m->mothurRemove(tempHeader); m->mothurRemove(accnosFileName); for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } for (int i = 0; i < lines.size(); i++) { delete lines[i]; } lines.clear(); delete chimera; return 0; }
}else{
processIDS.resize(0);
//append output files
for(int i=1;i<processors;i++){
m->appendFiles((outputFileName + toString(processIDS[i]) + ".temp"), outputFileName);
- remove((outputFileName + toString(processIDS[i]) + ".temp").c_str());
+ m->mothurRemove((outputFileName + toString(processIDS[i]) + ".temp"));
}
//append output files
for(int i=1;i<processors;i++){
m->appendFiles((accnosFileName + toString(processIDS[i]) + ".temp"), accnosFileName);
- remove((accnosFileName + toString(processIDS[i]) + ".temp").c_str());
+ m->mothurRemove((accnosFileName + toString(processIDS[i]) + ".temp"));
}
if (trim) {
for(int i=1;i<processors;i++){
m->appendFiles((trimFastaFileName + toString(processIDS[i]) + ".temp"), trimFastaFileName);
- remove((trimFastaFileName + toString(processIDS[i]) + ".temp").c_str());
+ m->mothurRemove((trimFastaFileName + toString(processIDS[i]) + ".temp"));
}
}
- if (m->control_pressed) { outputTypes.clear(); if (trim) { remove(trimFastaFileName.c_str()); } remove(outputFileName.c_str()); remove(accnosFileName.c_str()); for (int j = 0; j < outputNames.size(); j++) { remove(outputNames[j].c_str()); } for (int i = 0; i < lines.size(); i++) { delete lines[i]; } lines.clear(); delete chimera; return 0; }
+ if (m->control_pressed) { outputTypes.clear(); if (trim) { m->mothurRemove(trimFastaFileName); } m->mothurRemove(outputFileName); m->mothurRemove(accnosFileName); for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } for (int i = 0; i < lines.size(); i++) { delete lines[i]; } lines.clear(); delete chimera; return 0; }
}
#else
if (numNoParents == numSeqs) { m->mothurOut("[WARNING]: megablast returned 0 potential parents for all your sequences. This could be due to formatdb.exe not being setup properly, please check formatdb.log for errors."); m->mothurOutEndLine(); }
- if (m->control_pressed) { outputTypes.clear(); if (trim) { remove(trimFastaFileName.c_str()); } remove(outputFileName.c_str()); remove(tempHeader.c_str()); remove(accnosFileName.c_str()); for (int j = 0; j < outputNames.size(); j++) { remove(outputNames[j].c_str()); } for (int i = 0; i < lines.size(); i++) { delete lines[i]; } lines.clear(); delete chimera; return 0; }
+ if (m->control_pressed) { outputTypes.clear(); if (trim) { m->mothurRemove(trimFastaFileName); } m->mothurRemove(outputFileName); m->mothurRemove(tempHeader); m->mothurRemove(accnosFileName); for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } for (int i = 0; i < lines.size(); i++) { delete lines[i]; } lines.clear(); delete chimera; return 0; }
#endif
m->appendFiles(outputFileName, tempHeader);
- remove(outputFileName.c_str());
+ m->mothurRemove(outputFileName);
rename(tempHeader.c_str(), outputFileName.c_str());
#endif
string tempFile = outputFileName + toString(processIDS[i]) + ".num.temp";
m->openInputFile(tempFile, in);
if (!in.eof()) { int tempNum = 0; int tempNumParents = 0; in >> tempNum >> tempNumParents; num += tempNum; numNoParents += tempNumParents; }
- in.close(); remove(tempFile.c_str());
+ in.close(); m->mothurRemove(tempFile);
}
if (num == numNoParents) { m->mothurOut("[WARNING]: megablast returned 0 potential parents for all your sequences. This could be due to formatdb.exe not being setup properly, please check formatdb.log for errors."); m->mothurOutEndLine(); }
while (!in.eof()) {
- if (m->control_pressed) { in.close(); for (int j = 0; j < outputNames.size(); j++) { remove(outputNames[j].c_str()); } return 0; }
+ if (m->control_pressed) { in.close(); for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } return 0; }
Sequence seq(in); m->gobble(in);
seqs[seq.getName()] = seq.getAligned();
vector<seqPriorityNode> nameMapCount;
int error = m->readNames(nameFile, nameMapCount, seqs);
- if (m->control_pressed) { for (int j = 0; j < outputNames.size(); j++) { remove(outputNames[j].c_str()); } return 0; }
+ if (m->control_pressed) { for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } return 0; }
- if (error == 1) { for (int j = 0; j < outputNames.size(); j++) { remove(outputNames[j].c_str()); } return 0; }
- if (seqs.size() != nameMapCount.size()) { m->mothurOut( "The number of sequences in your fastafile does not match the number of sequences in your namefile, aborting."); m->mothurOutEndLine(); for (int j = 0; j < outputNames.size(); j++) { remove(outputNames[j].c_str()); } return 0; }
+ if (error == 1) { for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } return 0; }
+ if (seqs.size() != nameMapCount.size()) { m->mothurOut( "The number of sequences in your fastafile does not match the number of sequences in your namefile, aborting."); m->mothurOutEndLine(); for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } return 0; }
sort(nameMapCount.begin(), nameMapCount.end(), compareSeqPriorityNodes);
#ifdef USE_MPI
}
#endif
- if (m->control_pressed) { for (int j = 0; j < outputNames.size(); j++) { remove(outputNames[j].c_str()); } return 0; }
+ if (m->control_pressed) { for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } return 0; }
}
if (outputDir == "") { outputDir = m->hasPath(fastaFileNames[s]); }//if user entered a file with a path then preserve it
string accnosFileName = outputDir + m->getRootName(m->getSimpleName(fastaFileNames[s])) + "uchime.accnos";
string alnsFileName = outputDir + m->getRootName(m->getSimpleName(fastaFileNames[s])) + "uchime.alns";
- if (m->control_pressed) { for (int j = 0; j < outputNames.size(); j++) { remove(outputNames[j].c_str()); } return 0; }
+ if (m->control_pressed) { for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } return 0; }
int numSeqs = 0;
#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
#else
numSeqs = driver(outputFileName, fastaFileNames[s], accnosFileName, alnsFileName);
#endif
- if (m->control_pressed) { for (int j = 0; j < outputNames.size(); j++) { remove(outputNames[j].c_str()); } return 0; }
+ if (m->control_pressed) { for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } return 0; }
//remove file made for uchime
- if (templatefile == "self") { remove(fastaFileNames[s].c_str()); }
+ if (templatefile == "self") { m->mothurRemove(fastaFileNames[s]); }
outputNames.push_back(outputFileName); outputTypes["chimera"].push_back(outputFileName);
outputNames.push_back(accnosFileName); outputTypes["accnos"].push_back(accnosFileName);
num += temp;
m->appendFiles((outputFileName + toString(j) + ".temp"), outputFileName);
- remove((outputFileName + toString(j) + ".temp").c_str());
+ m->mothurRemove((outputFileName + toString(j) + ".temp"));
m->appendFiles((accnos + toString(j) + ".temp"), accnos);
- remove((accnos + toString(j) + ".temp").c_str());
+ m->mothurRemove((accnos + toString(j) + ".temp"));
if (chimealns) {
m->appendFiles((alns + toString(j) + ".temp"), alns);
- remove((alns + toString(j) + ".temp").c_str());
+ m->mothurRemove((alns + toString(j) + ".temp"));
}
}
}
string tempFile = outputFileName + 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);
}
//append output files
for(int i=0;i<processIDS[i];i++){
m->appendFiles((outputFileName + toString(processIDS[i]) + ".temp"), outputFileName);
- remove((outputFileName + toString(processIDS[i]) + ".temp").c_str());
+ m->mothurRemove((outputFileName + toString(processIDS[i]) + ".temp"));
m->appendFiles((accnos + toString(processIDS[i]) + ".temp"), accnos);
- remove((accnos + toString(processIDS[i]) + ".temp").c_str());
+ m->mothurRemove((accnos + toString(processIDS[i]) + ".temp"));
if (chimealns) {
m->appendFiles((alns + toString(processIDS[i]) + ".temp"), alns);
- remove((alns + toString(processIDS[i]) + ".temp").c_str());
+ m->mothurRemove((alns + toString(processIDS[i]) + ".temp"));
}
}
#endif
//get rid of the file pieces.
- for (int i = 0; i < files.size(); i++) { remove(files[i].c_str()); }
+ for (int i = 0; i < files.size(); i++) { m->mothurRemove(files[i]); }
#endif
return num;
}
Sequence seq(in);
- if (m->control_pressed) { outputTypes.clear(); in.close(); out.close(); outAcc.close(); remove(outputFileName.c_str()); remove(outputFileNameAccnos.c_str()); return 0; }
+ if (m->control_pressed) { outputTypes.clear(); in.close(); out.close(); outAcc.close(); m->mothurRemove(outputFileName); m->mothurRemove(outputFileNameAccnos); return 0; }
if (seq.getName() != "") {
string newSeqString = getChopped(seq);
m->mothurOut(outputFileName); m->mothurOutEndLine(); outputNames.push_back(outputFileName); outputTypes["fasta"].push_back(outputFileName);
if (wroteAccnos) { m->mothurOut(outputFileNameAccnos); m->mothurOutEndLine(); outputNames.push_back(outputFileNameAccnos); outputTypes["accnos"].push_back(outputFileNameAccnos); }
- else { remove(outputFileNameAccnos.c_str()); }
+ else { m->mothurRemove(outputFileNameAccnos); }
m->mothurOutEndLine();
set<string> processedLabels;
set<string> userLabels = labels;
- if (m->control_pressed) { outputTypes.clear(); delete input; delete list; for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { outputTypes.clear(); delete input; delete list; for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
while((list != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
m->mothurOut(list->getLabel() + "\t" + toString(list->size())); m->mothurOutEndLine();
process(list);
- if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } delete input; delete list; return 0; }
+ if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } delete input; delete list; return 0; }
processedLabels.insert(list->getLabel());
userLabels.erase(list->getLabel());
process(list);
- if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } delete input; delete list; return 0; }
+ if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } delete input; delete list; return 0; }
processedLabels.insert(list->getLabel());
userLabels.erase(list->getLabel());
process(list);
delete list;
- if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } delete input; delete list; return 0; }
+ if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } delete input; delete list; return 0; }
}
delete input;
- if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
phylo->assignHeirarchyIDs(0);
TaxNode currentNode = phylo->get(0);
-
+ int myLevel = 0;
//at each level
while (currentNode.children.size() != 0) { //you still have more to explore
}else{
conTax += bestChild.name + ";";
}
+ myLevel++;
}else{ //if no, quit
break;
}
currentNode = bestChild;
}
-
+ if (myLevel != phylo->getMaxLevel()) {
+ while (myLevel != phylo->getMaxLevel()) {
+ conTax += "unclassified;";
+ myLevel++;
+ }
+ }
if (conTax == "") { conTax = "no_consensus;"; }
delete phylo;
exit(1);
}
}
+/**************************************************************************************************/
+string ClassifyOtuCommand::addUnclassifieds(string tax, int maxlevel) {
+ try{
+ string newTax, taxon;
+ int level = 0;
+
+ //keep what you have counting the levels
+ while (tax.find_first_of(';') != -1) {
+ //get taxon
+ taxon = tax.substr(0,tax.find_first_of(';'))+';';
+ tax = tax.substr(tax.find_first_of(';')+1, tax.length());
+ newTax += taxon;
+ level++;
+ }
+
+ //add "unclassified" until you reach maxLevel
+ while (level < maxlevel) {
+ newTax += "unclassified;";
+ level++;
+ }
+
+ return newTax;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "ClassifyOtuCommand", "addUnclassifieds");
+ exit(1);
+ }
+}
+
/**************************************************************************************************/
void ClassifyOtuCommand::removeConfidences(string& tax) {
try {
int readTaxonomyFile();
void removeConfidences(string&);
int process(ListVector*);
+ string addUnclassifieds(string, int);
vector<string> findConsensusTaxonomy(int, ListVector*, int&, string&); // returns the name of the "representative" taxonomy of given bin
//align your part
driverMPI(startIndex, numSeqsPerProcessor, inMPI, outMPINewTax, outMPITempTax, MPIPos);
- if (m->control_pressed) { outputTypes.clear(); MPI_File_close(&inMPI); MPI_File_close(&outMPINewTax); MPI_File_close(&outMPITempTax); for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } delete classify; return 0; }
+ if (m->control_pressed) { outputTypes.clear(); MPI_File_close(&inMPI); MPI_File_close(&outMPINewTax); MPI_File_close(&outMPITempTax); for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } delete classify; return 0; }
for (int i = 1; i < processors; i++) {
int done;
PhyloSummary taxaSum(baseTName, group);
- if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } delete classify; return 0; }
+ if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } delete classify; return 0; }
if (namefile == "") { taxaSum.summarize(tempTaxonomyFile); }
else {
}
in.close();
}
- remove(tempTaxonomyFile.c_str());
+ m->mothurRemove(tempTaxonomyFile);
- if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } delete classify; return 0; }
+ if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } delete classify; return 0; }
//print summary file
ofstream outTaxTree;
//read taxfile - this reading and rewriting is done to preserve the confidence scores.
string name, taxon;
while (!inTax.eof()) {
- if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } remove(unclass.c_str()); delete classify; return 0; }
+ if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } m->mothurRemove(unclass); delete classify; return 0; }
inTax >> name >> taxon; m->gobble(inTax);
inTax.close();
outTax.close();
- remove(newTaxonomyFile.c_str());
+ m->mothurRemove(newTaxonomyFile);
rename(unclass.c_str(), newTaxonomyFile.c_str());
m->mothurOutEndLine();
process++;
}else if (pid == 0){
num = driver(lines[process], taxFileName + toString(getpid()) + ".temp", tempTaxFile + toString(getpid()) + ".temp", filename);
-
+
//pass numSeqs to parent
ofstream out;
string tempFile = filename + toString(getpid()) + ".num.temp";
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(m->getFullPathName(tempFile));
}
for(int i=0;i<processIDS.size();i++){
appendTaxFiles((taxFileName + toString(processIDS[i]) + ".temp"), taxFileName);
appendTaxFiles((tempTaxFile + toString(processIDS[i]) + ".temp"), tempTaxFile);
- remove((taxFileName + toString(processIDS[i]) + ".temp").c_str());
- remove((tempTaxFile + toString(processIDS[i]) + ".temp").c_str());
+ m->mothurRemove((m->getFullPathName(taxFileName) + toString(processIDS[i]) + ".temp"));
+ m->mothurRemove((m->getFullPathName(tempTaxFile) + toString(processIDS[i]) + ".temp"));
}
return num;
if (m->control_pressed) { //clean up
delete list; delete matrix; delete rabund;
sabundFile.close();rabundFile.close();listFile.close();
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear();
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear();
return 0;
}
if (m->control_pressed) { //clean up
delete list; delete matrix; delete rabund; delete cluster;
sabundFile.close();rabundFile.close();listFile.close();
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear();
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear();
return 0;
}
int estart = time(NULL);
while ((cluster->getSmallDist() < cutoff) && (cluster->getNSeqs() > 1)){
- if (m->control_pressed) { delete cluster; delete list; delete rabund; sabundFile.close();rabundFile.close();listFile.close(); for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear(); return 0; }
+ if (m->control_pressed) { delete cluster; delete list; delete rabund; sabundFile.close();rabundFile.close();listFile.close(); for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear(); return 0; }
cluster->update(cutoff);
m->mothurOut("It took " + toString(time(NULL) - start) + " secs to cluster " + toString(numSeqs) + " sequences."); m->mothurOutEndLine();
- if (m->control_pressed) { remove(newFastaFile.c_str()); remove(newNamesFile.c_str()); return 0; }
+ if (m->control_pressed) { m->mothurRemove(newFastaFile); m->mothurRemove(newNamesFile); return 0; }
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
listFileNames.push_back(tempName);
}
in.close();
- remove((toString(processIDS[i]) + ".temp").c_str());
+ m->mothurRemove((toString(processIDS[i]) + ".temp"));
//get labels
filename = toString(processIDS[i]) + ".temp.labels";
if (labels.count(tempName) == 0) { labels.insert(tempName); }
}
in2.close();
- remove((toString(processIDS[i]) + ".temp.labels").c_str());
+ m->mothurRemove((toString(processIDS[i]) + ".temp.labels"));
}
}
#else
listFileNames = cluster(distName, labels); //clusters individual files and returns names of list files
#endif
#endif
- if (m->control_pressed) { for (int i = 0; i < listFileNames.size(); i++) { remove(listFileNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { for (int i = 0; i < listFileNames.size(); i++) { m->mothurRemove(listFileNames[i]); } return 0; }
if (saveCutoff != cutoff) { m->mothurOut("Cutoff was " + toString(saveCutoff) + " changed cutoff to " + toString(cutoff)); m->mothurOutEndLine(); }
ListVector* listSingle;
map<float, int> labelBins = completeListFile(listFileNames, singletonName, labels, listSingle); //returns map of label to numBins
- if (m->control_pressed) { if (listSingle != NULL) { delete listSingle; } for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { if (listSingle != NULL) { delete listSingle; } for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
mergeLists(listFileNames, labelBins, listSingle);
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
m->mothurOut("It took " + toString(time(NULL) - estart) + " seconds to merge."); m->mothurOutEndLine();
listSingle->push_back(secondCol);
}
in.close();
- remove(singleton.c_str());
+ m->mothurRemove(singleton);
numSingleBins = listSingle->getNumBins();
}else{ listSingle = NULL; numSingleBins = 0; }
for (int k = 0; k < listNames.size(); k++) {
if (m->control_pressed) {
- if (listSingle != NULL) { delete listSingle; listSingle = NULL; remove(singleton.c_str()); }
- for (int i = 0; i < listNames.size(); i++) { remove(listNames[i].c_str()); }
+ if (listSingle != NULL) { delete listSingle; listSingle = NULL; m->mothurRemove(singleton); }
+ for (int i = 0; i < listNames.size(); i++) { m->mothurRemove(listNames[i]); }
return labelBin;
}
delete input;
outFilled.close();
- remove(listNames[k].c_str());
+ m->mothurRemove(listNames[k]);
rename(filledInList.c_str(), listNames[k].c_str());
}
//get the list info from each file
for (int k = 0; k < listNames.size(); k++) {
- if (m->control_pressed) { if (listSingle != NULL) { delete listSingle; } for (int i = 0; i < listNames.size(); i++) { remove(listNames[i].c_str()); } delete rabund; return 0; }
+ if (m->control_pressed) { if (listSingle != NULL) { delete listSingle; } for (int i = 0; i < listNames.size(); i++) { m->mothurRemove(listNames[i]); } delete rabund; return 0; }
InputData* input = new InputData(listNames[k], "list");
ListVector* list = input->getListVector(thisLabel);
if (listSingle != NULL) { delete listSingle; }
- for (int i = 0; i < listNames.size(); i++) { remove(listNames[i].c_str()); }
+ for (int i = 0; i < listNames.size(); i++) { m->mothurRemove(listNames[i]); }
return 0;
}
if (m->control_pressed) { //clean up
delete matrix; delete list; delete cluster; delete rabund;
listFile.close();
- for (int i = 0; i < listFileNames.size(); i++) { remove(listFileNames[i].c_str()); }
+ for (int i = 0; i < listFileNames.size(); i++) { m->mothurRemove(listFileNames[i]); }
listFileNames.clear(); return listFileNames;
}
listFile.close();
if (m->control_pressed) { //clean up
- for (int i = 0; i < listFileNames.size(); i++) { remove(listFileNames[i].c_str()); }
+ for (int i = 0; i < listFileNames.size(); i++) { m->mothurRemove(listFileNames[i]); }
listFileNames.clear(); return listFileNames;
}
- remove(thisDistFile.c_str());
- remove(thisNamefile.c_str());
+ m->mothurRemove(thisDistFile);
+ m->mothurRemove(thisNamefile);
if (saveCutoff != cutoff) {
if (hard) { saveCutoff = m->ceilDist(saveCutoff, precision); }
string thisOutputDir = outputDir;
if (outputDir == "") { thisOutputDir = m->hasPath(fastafile); }
string outputFileName = thisOutputDir + m->getRootName(m->getSimpleName(fastafile)) + "dist";
- remove(outputFileName.c_str());
+ m->mothurRemove(outputFileName);
for (int i = 0; i < distNames.size(); i++) {
for (int p = 0; p < inputFileNames.size(); p++) {
- if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } m->Groups.clear(); return 0; }
+ if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } m->Groups.clear(); return 0; }
if (outputDir == "") { outputDir += m->hasPath(inputFileNames[p]); }
string fileNameRoot = outputDir + m->getRootName(m->getSimpleName(inputFileNames[p]));
if (m->control_pressed) {
for(int i=0;i<cDisplays.size();i++){ delete cDisplays[i]; }
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear();
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear();
delete input;
delete order;
m->Groups.clear();
if (m->control_pressed) {
for(int i=0;i<cDisplays.size();i++){ delete cDisplays[i]; }
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear();
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear();
delete input;
delete order;
m->Groups.clear();
if (m->control_pressed) {
for(int i=0;i<cDisplays.size();i++){ delete cDisplays[i]; }
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear();
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear();
delete input;
m->Groups.clear();
return 0;
if (m->control_pressed) {
for(int i=0;i<cDisplays.size();i++){ delete cDisplays[i]; }
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear();
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear();
delete input;
delete order;
m->Groups.clear();
delete input;
}
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
//clears file before we start to write to it below
for (int i=0; i<lookup.size(); i++) {
- remove((sharedFileRoot + lookup[i]->getGroup() + ".rabund").c_str());
+ m->mothurRemove((sharedFileRoot + lookup[i]->getGroup() + ".rabund"));
filenames.push_back((sharedFileRoot + lookup[i]->getGroup() + ".rabund"));
}
while((order != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
if (m->control_pressed) {
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear();
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear();
for(int i=0;i<cDisplays.size();i++){ delete cDisplays[i]; }
delete order; delete input;
m->Groups.clear();
}
if (m->control_pressed) {
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear();
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear();
for(int i=0;i<cDisplays.size();i++){ delete cDisplays[i]; }
m->Groups.clear();
delete input;
delete cCurve;
if (m->control_pressed) {
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear();
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear();
for(int i=0;i<cDisplays.size();i++){ delete cDisplays[i]; }
delete order;
delete input;
int seqLength = 0;
for (map<string, string>::iterator it = nameMap.begin(); it != nameMap.end(); it++) {
- if (m->control_pressed) { outSummary.close(); outFasta.close(); for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { outSummary.close(); outFasta.close(); for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
string seq = fastaMap[it->second];
seqs.push_back(seq);
//get counts
for (int j = 0; j < seqLength; j++) {
- if (m->control_pressed) { outSummary.close(); outFasta.close(); for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { outSummary.close(); outFasta.close(); for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
vector<int> counts; counts.resize(5, 0); //A,T,G,C,Gap
int numDots = 0;
//as long as you are not at the end of the file or done wih the lines you want
while((list != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } delete list; delete input; return 0; }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } delete list; delete input; return 0; }
if(allLines == 1 || labels.count(list->getLabel()) == 1){
}
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } if (list != NULL) { delete list; } delete input; return 0; }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } if (list != NULL) { delete list; } delete input; return 0; }
//output error messages about any remaining user labels
set<string>::iterator it;
if (groupfile != "") { delete groupMap; }
- if (m->control_pressed) { remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { m->mothurRemove(outputFileName); return 0; }
m->mothurOutEndLine();
m->mothurOut("Output File Name: "); m->mothurOutEndLine();
int count = 0;
while (!in.eof()) {
- if (m->control_pressed) { in.close(); outFasta.close(); remove(outFastaFile.c_str()); return 0; }
+ if (m->control_pressed) { in.close(); outFasta.close(); m->mothurRemove(outFastaFile); return 0; }
Sequence seq(in);
in.close();
outFasta.close();
- if (m->control_pressed) { remove(outFastaFile.c_str()); return 0; }
+ if (m->control_pressed) { m->mothurRemove(outFastaFile); return 0; }
//print new names file
ofstream outNames;
m->openOutputFile(outNameFile, outNames);
for (itStrings = sequenceStrings.begin(); itStrings != sequenceStrings.end(); itStrings++) {
- if (m->control_pressed) { outputTypes.clear(); remove(outFastaFile.c_str()); outNames.close(); remove(outNameFile.c_str()); return 0; }
+ if (m->control_pressed) { outputTypes.clear(); m->mothurRemove(outFastaFile); outNames.close(); m->mothurRemove(outNameFile); return 0; }
//get rep name
int pos = (itStrings->second).find_first_of(',');
}
outNames.close();
- if (m->control_pressed) { outputTypes.clear(); remove(outFastaFile.c_str()); remove(outNameFile.c_str()); return 0; }
+ if (m->control_pressed) { outputTypes.clear(); m->mothurRemove(outFastaFile); m->mothurRemove(outNameFile); return 0; }
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
m->openOutputFile(degapFile, outFASTA);
while(!inFASTA.eof()){
- if (m->control_pressed) { outputTypes.clear(); inFASTA.close(); outFASTA.close(); remove(degapFile.c_str()); for (int j = 0; j < outputNames.size(); j++) { remove(outputNames[j].c_str()); } return 0; }
+ if (m->control_pressed) { outputTypes.clear(); inFASTA.close(); outFASTA.close(); m->mothurRemove(degapFile); for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } return 0; }
Sequence currSeq(inFASTA); m->gobble(inFASTA);
if (currSeq.getName() != "") {
outputNames.push_back(degapFile); outputTypes["fasta"].push_back(degapFile);
- if (m->control_pressed) { outputTypes.clear(); remove(degapFile.c_str()); for (int j = 0; j < outputNames.size(); j++) { remove(outputNames[j].c_str()); } return 0; }
+ if (m->control_pressed) { outputTypes.clear(); m->mothurRemove(degapFile); for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } return 0; }
}
//set fasta file as new current fastafile
m->openOutputFile(outFastaFile, out);
readNamesFile();
- if (m->control_pressed) { out.close(); outputTypes.clear(); remove(outFastaFile.c_str()); return 0; }
+ if (m->control_pressed) { out.close(); outputTypes.clear(); m->mothurRemove(outFastaFile); return 0; }
ifstream in;
m->openInputFile(fastaFile, in);
while (!in.eof()) {
- if (m->control_pressed) { in.close(); out.close(); outputTypes.clear(); remove(outFastaFile.c_str()); return 0; }
+ if (m->control_pressed) { in.close(); out.close(); outputTypes.clear(); m->mothurRemove(outFastaFile); return 0; }
Sequence seq(in); m->gobble(in);
}
}
- if (m->control_pressed) { outputTypes.clear(); remove(outFastaFile.c_str()); return 0; }
+ if (m->control_pressed) { outputTypes.clear(); m->mothurRemove(outFastaFile); return 0; }
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
if (m->control_pressed) {
delete tmap; for (int i = 0; i < T.size(); i++) { delete T[i]; }
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear();
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear();
m->Groups.clear();
return 0;
}
if (output == "lt") { //does the user want lower triangle phylip formatted file
outputFile = outputDir + m->getRootName(m->getSimpleName(fastafile)) + "phylip.dist";
- remove(outputFile.c_str()); outputTypes["phylip"].push_back(outputFile);
+ m->mothurRemove(outputFile); outputTypes["phylip"].push_back(outputFile);
//output numSeqs to phylip formatted dist file
}else if (output == "column") { //user wants column format
rename(column.c_str(), tempcolumn.c_str());
}
- remove(outputFile.c_str());
+ m->mothurRemove(outputFile);
}else { //assume square
outputFile = outputDir + m->getRootName(m->getSimpleName(fastafile)) + "square.dist";
- remove(outputFile.c_str());
+ m->mothurRemove(outputFile);
outputTypes["phylip"].push_back(outputFile);
}
#endif
#endif
- if (m->control_pressed) { outputTypes.clear(); delete distCalculator; remove(outputFile.c_str()); return 0; }
+ if (m->control_pressed) { outputTypes.clear(); delete distCalculator; m->mothurRemove(outputFile); return 0; }
#ifdef USE_MPI
MPI_Comm_rank(MPI_COMM_WORLD, &pid);
if (outputFile == column) {
string tempcolumn = column + ".old";
m->appendFiles(tempcolumn, outputFile);
- remove(tempcolumn.c_str());
+ m->mothurRemove(tempcolumn);
}else{
m->appendFiles(outputFile, column);
- remove(outputFile.c_str());
+ m->mothurRemove(outputFile);
outputFile = column;
}
if (outputDir != "") {
string newOutputName = outputDir + m->getSimpleName(outputFile);
rename(outputFile.c_str(), newOutputName.c_str());
- remove(outputFile.c_str());
+ m->mothurRemove(outputFile);
outputFile = newOutputName;
}
}
}
#endif
- if (m->control_pressed) { outputTypes.clear(); delete distCalculator; remove(outputFile.c_str()); return 0; }
+ if (m->control_pressed) { outputTypes.clear(); delete distCalculator; m->mothurRemove(outputFile); return 0; }
delete distCalculator;
//append and remove temp files
for (int i=0;i<processIDS.size();i++) {
m->appendFiles((filename + toString(processIDS[i]) + ".temp"), filename);
- remove((filename + toString(processIDS[i]) + ".temp").c_str());
+ m->mothurRemove((filename + toString(processIDS[i]) + ".temp"));
}
#endif
}
//m->openInputFile(outfile, in);
while(!in.eof()) {
- if (m->control_pressed) { in.close(); remove(outfile.c_str()); out.close(); return 0; }
+ if (m->control_pressed) { in.close(); m->mothurRemove(outfile); out.close(); return 0; }
in >> first >> second >> dist; m->gobble(in);
in.close();
out.close();
- remove(outfile.c_str());
+ m->mothurRemove(outfile);
return 1;
//m->openInputFile(outfile, in);
while(!in.eof()) {
- if (m->control_pressed) { in.close(); remove(outfile.c_str()); out.close(); return 0; }
+ if (m->control_pressed) { in.close(); m->mothurRemove(outfile); out.close(); return 0; }
in >> first >> second >> dist; m->gobble(in);
in.close();
out.close();
- remove(outfile.c_str());
+ m->mothurRemove(outfile);
return 1;
string name1, name2;
float dist;
while (!inDist.eof()) {
- if (m->control_pressed) { inDist.close(); outDist.close(); remove(outputFile.c_str()); return good; }
+ if (m->control_pressed) { inDist.close(); outDist.close(); m->mothurRemove(outputFile); return good; }
inDist >> name1 >> name2 >> dist; m->gobble(inDist);
outDist.close();
if (good) {
- remove(column.c_str());
+ m->mothurRemove(column);
rename(outputFile.c_str(), column.c_str());
}else{
- remove(outputFile.c_str()); //temp file is bad because file mismatch above
+ m->mothurRemove(outputFile); //temp file is bad because file mismatch above
}
return good;
inFile.close();
outFile.close();
- remove(outName.c_str());
+ m->mothurRemove(outName);
}
/***********************************************************************/
}
counter = 1;
- remove(inName.c_str());
+ m->mothurRemove(inName);
renameOk = rename(outName.c_str(), inName.c_str());
//renameFile(outName, inName);
inFile.close();
outFile.close();
- remove(outName.c_str());
+ m->mothurRemove(outName);
}
/***********************************************************************/
}
counter = 1;
- remove(inName.c_str());
+ m->mothurRemove(inName);
renameOk = rename(outName.c_str(), inName.c_str());
//renameFile(outName, inName);
inFile.close();
outFile.close();
- remove(outName.c_str());
+ m->mothurRemove(outName);
}
/***********************************************************************/
}
counter = 1;
- remove(inName.c_str());
+ m->mothurRemove(inName);
renameOk = rename(outName.c_str(), inName.c_str());
//renameFile(outName, inName);
inFile.close();
outFile.close();
- remove(outName.c_str());
+ m->mothurRemove(outName);
}
/***********************************************************************/
}
counter = 1;
- remove(inName.c_str());
+ m->mothurRemove(inName);
renameOk = rename(outName.c_str(), inName.c_str());
//renameFile(outName, inName);
inFile.close();
outFile.close();
- remove(outName.c_str());
+ m->mothurRemove(outName);
}
/***********************************************************************/
}
counter = 1;
- remove(inName.c_str());
+ m->mothurRemove(inName);
renameOk = rename(outName.c_str(), inName.c_str());
//renameFile(outName, inName);
if(filter[i] == '1'){ filteredLength++; }
}
- if (m->control_pressed) { outputTypes.clear(); for(int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { outputTypes.clear(); for(int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
m->mothurOutEndLine();
//append fasta files
for(int i=1;i<processors;i++){
m->appendFiles((fastafileNames[s] + toString(processIDS[i]) + ".temp"), filteredFasta);
- remove((fastafileNames[s] + toString(processIDS[i]) + ".temp").c_str());
+ m->mothurRemove((fastafileNames[s] + toString(processIDS[i]) + ".temp"));
}
}
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);
}
for (int k = 0; k < alignmentLength; k++) { in >> temp; F.gap[k] += temp; } m->gobble(in);
in.close();
- remove(tempFilename.c_str());
+ m->mothurRemove(tempFilename);
}
return num;
static double alogam(double *x, int *ifault);
-
-
/* The only public function : */
void fexact(int *nrow, int *ncol, double *table, int *ldtabl,
double *expect, double *percnt, double *emin, double *prt,
/* AMISS is a missing value indicator which is returned when the
probability is not defined. */
const double amiss = -12345.;
-
+
/* TOL is chosen as the square root of the smallest relative spacing. */
#ifndef Macintosh
const static double tol = 3.45254e-7;
double alogam(double *x, int *ifault)
{
/* Initialized data */
-
+ //printf("alogam x = %f\t%d\n",*x,*ifault);
static double a1 = .918938533204673;
static double a2 = 5.95238095238e-4;
static double a3 = 7.93650793651e-4;
f = -log(f);
L30:
z = 1. / (y * y);
+
+ //printf("returning %f\n",(f + (y - .5) * log(y) - y + a1 + (((-a2 * z + a3) * z - a4) * z + a5) / y));
return(f + (y - .5) * log(y) - y + a1 +
(((-a2 * z + a3) * z - a4) * z + a5) / y);
}
while(fileHandle && lt == 1){ //let's assume it's a triangular matrix...
- if (m->control_pressed) { out.close(); remove(tempOutFile.c_str()); fileHandle.close(); delete reading; return 0; }
+ if (m->control_pressed) { out.close(); m->mothurRemove(tempOutFile); fileHandle.close(); delete reading; return 0; }
fileHandle >> firstName >> secondName >> distance; // get the row and column names and distance
system(command.c_str());
#endif
- if (m->control_pressed) { remove(tempOutFile.c_str()); remove(outfile.c_str()); delete reading; return 0; }
+ if (m->control_pressed) { m->mothurRemove(tempOutFile); m->mothurRemove(outfile); delete reading; return 0; }
//output to new file distance for each row and save positions in file where new row begins
ifstream in;
while(!in.eof()) {
- if (m->control_pressed) { in.close(); out.close(); remove(distFile.c_str()); remove(tempOutFile.c_str()); remove(outfile.c_str()); delete reading; return 0; }
+ if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(distFile); m->mothurRemove(tempOutFile); m->mothurRemove(outfile); delete reading; return 0; }
in >> first >> second >> dist; m->gobble(in);
in.close();
out.close();
- if (m->control_pressed) { remove(distFile.c_str()); remove(tempOutFile.c_str()); remove(outfile.c_str()); delete reading; return 0; }
+ if (m->control_pressed) { m->mothurRemove(distFile); m->mothurRemove(tempOutFile); m->mothurRemove(outfile); delete reading; return 0; }
- remove(tempOutFile.c_str());
- remove(outfile.c_str());
+ m->mothurRemove(tempOutFile);
+ m->mothurRemove(outfile);
reading->finish();
delete reading;
list->setLabel("0");
- if (m->control_pressed) { remove(distFile.c_str()); return 0; }
+ if (m->control_pressed) { m->mothurRemove(distFile); return 0; }
return 1;
for(int j=0;j<i;j++){
- if (m->control_pressed) { outTemp.close(); remove(tempFile.c_str()); fileHandle.close(); delete reading; return 0; }
+ if (m->control_pressed) { outTemp.close(); m->mothurRemove(tempFile); fileHandle.close(); delete reading; return 0; }
fileHandle >> distance;
system(command.c_str());
#endif
- if (m->control_pressed) { remove(tempFile.c_str()); remove(outfile.c_str()); delete reading; return 0; }
+ if (m->control_pressed) { m->mothurRemove(tempFile); m->mothurRemove(outfile); delete reading; return 0; }
//output to new file distance for each row and save positions in file where new row begins
ifstream in;
for(int k = 0; k < firstString.length(); k++) { in.putback(firstString[k]); }
while(!in.eof()) {
- if (m->control_pressed) { in.close(); out.close(); remove(tempFile.c_str()); remove(distFile.c_str()); remove(outfile.c_str()); delete reading; return 0; }
+ if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(tempFile); m->mothurRemove(distFile); m->mothurRemove(outfile); delete reading; return 0; }
in >> first >> second >> dist; m->gobble(in);
in.close();
out.close();
- remove(tempFile.c_str());
- remove(outfile.c_str());
+ m->mothurRemove(tempFile);
+ m->mothurRemove(outfile);
- if (m->control_pressed) { remove(distFile.c_str()); delete reading; return 0; }
+ if (m->control_pressed) { m->mothurRemove(distFile); delete reading; return 0; }
}
else{ //square matrix convert directly to formatted row file
list->set(i, name);
for(int j=0;j<nseqs;j++){
- if (m->control_pressed) { fileHandle.close(); out.close(); remove(distFile.c_str()); delete reading; return 0; }
+ if (m->control_pressed) { fileHandle.close(); out.close(); m->mothurRemove(distFile); delete reading; return 0; }
fileHandle >> distance;
fileHandle.close();
out.close();
- if (m->control_pressed) { remove(distFile.c_str()); return 0; }
+ if (m->control_pressed) { m->mothurRemove(distFile); return 0; }
list->setLabel("0");
//loop through each command outputting info
for (it = commands.begin(); it != commands.end(); it++) {
- if (m->control_pressed) { m->mothurOut("[ERROR]: did not complete making the file."); m->mothurOutEndLine(); out.close(); remove((output+".temp").c_str()); }
+ if (m->control_pressed) { m->mothurOut("[ERROR]: did not complete making the file."); m->mothurOutEndLine(); out.close(); m->mothurRemove((output+".temp")); }
Command* thisCommand = commandFactory->getCommand(it->first);
out2.close();
m->appendFiles(output+".temp", output);
- remove((output+".temp").c_str());
+ m->mothurRemove((output+".temp"));
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
in >> inputData;
}
- if (m->control_pressed) { outputTypes.clear(); in.close(); out.close(); remove(outputFile.c_str()); return 0; }
+ if (m->control_pressed) { outputTypes.clear(); in.close(); out.close(); m->mothurRemove(outputFile); return 0; }
if (in.eof() != true) { in >> nextLabel; }
//read the rest of the groups info in
while ((nextLabel == holdLabel) && (in.eof() != true)) {
- if (m->control_pressed) { outputTypes.clear(); in.close(); out.close(); remove(outputFile.c_str()); return 0; }
+ if (m->control_pressed) { outputTypes.clear(); in.close(); out.close(); m->mothurRemove(outputFile); return 0; }
in >> groupN >> num;
count++;
in.close();
out.close();
- if (m->control_pressed) { remove(outputFile.c_str()); return 0; }
+ if (m->control_pressed) { m->mothurRemove(outputFile); return 0; }
m->mothurOutEndLine();
m->mothurOut("Output File Name: "); m->mothurOutEndLine();
if (listfile != "") { readList(); }
if (taxfile != "") { readTax(); }
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
m->mothurOut("Selected " + toString(names.size()) + " sequences. From the groups: "); m->mothurOutEndLine();
for (int i = 0; i < Groups.size(); i++) { m->mothurOut(Groups[i]); m->mothurOut("\t" + toString(groupMap->getNumSeqs(Groups[i]))); m->mothurOutEndLine(); }
bool wroteSomething = false;
while(!in.eof()){
- if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outputFileName); return 0; }
Sequence currSeq(in);
name = currSeq.getName();
//for each bin
for (int i = 0; i < list.getNumBins(); i++) {
- if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outputFileName); return 0; }
//parse out names that are in accnos file
string binnames = list.get(i);
bool wroteSomething = false;
while(!in.eof()){
- if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outputFileName); return 0; }
in >> firstCol; m->gobble(in);
in >> secondCol;
bool wroteSomething = false;
while(!in.eof()){
- if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outputFileName); return 0; }
in >> name; //read from first column
in >> group; //read from second column
bool wroteSomething = false;
while(!in.eof()){
- if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outputFileName); return 0; }
in >> name; //read from first column
in >> tax; //read from second column
if (listfile != "") { readList(); }
- if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
if (outputNames.size() != 0) {
m->mothurOutEndLine();
while(!in.eof()){
- if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outputFileName); return 0; }
Sequence currSeq(in);
name = currSeq.getName();
while(!in.eof()){
- if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outputFileName); return 0; }
//read in list vector
ListVector list(in);
while(!in.eof()){
- if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outputFileName); return 0; }
in >> firstCol;
in >> secondCol;
while(!in.eof()){
- if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outputFileName); return 0; }
in >> name; //read from first column
while(!in.eof()){
- if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outputFileName); return 0; }
in >> name; //read from first column
in >> tax; //read from second column
while(!in.eof()){
- if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outputFileName); return 0; }
in >> name; //read from first column
set<string> processedLabels;
set<string> userLabels = labels;
- if (m->control_pressed) { delete input; delete list; for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { delete input; delete list; for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
while((list != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
process(list);
- if (m->control_pressed) { delete input; delete list; for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { delete input; delete list; for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
processedLabels.insert(list->getLabel());
userLabels.erase(list->getLabel());
process(list);
- if (m->control_pressed) { delete input; delete list; for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { delete input; delete list; for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
processedLabels.insert(list->getLabel());
process(list);
- if (m->control_pressed) { delete input; delete list; for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { delete input; delete list; for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
delete list;
}
//openfile for getMap to use
m->openInputFile(distFile, inRow);
- if (m->control_pressed) { inRow.close(); remove(distFile.c_str()); return 0; }
+ if (m->control_pressed) { inRow.close(); m->mothurRemove(distFile); return 0; }
}
if (m->control_pressed) {
- if (large) { inRow.close(); remove(distFile.c_str()); }
+ if (large) { inRow.close(); m->mothurRemove(distFile); }
return 0;
}
set<string> userLabels = labels;
if (m->control_pressed) {
- if (large) { inRow.close(); remove(distFile.c_str()); }
+ if (large) { inRow.close(); m->mothurRemove(distFile); }
delete input; delete list; return 0;
}
if (error == 1) { return 0; } //there is an error in hte input files, abort command
if (m->control_pressed) {
- if (large) { inRow.close(); remove(distFile.c_str()); }
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear();
+ if (large) { inRow.close(); m->mothurRemove(distFile); }
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear();
delete input; delete list; return 0;
}
if (error == 1) { return 0; } //there is an error in hte input files, abort command
if (m->control_pressed) {
- if (large) { inRow.close(); remove(distFile.c_str()); }
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear();
+ if (large) { inRow.close(); m->mothurRemove(distFile); }
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear();
delete input; delete list; return 0;
}
if (error == 1) { return 0; } //there is an error in hte input files, abort command
if (m->control_pressed) {
- if (large) { inRow.close(); remove(distFile.c_str()); }
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear();
+ if (large) { inRow.close(); m->mothurRemove(distFile); }
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear();
delete input; delete list; return 0;
}
}
//close and remove formatted matrix file
if (large) {
inRow.close();
- remove(distFile.c_str());
+ m->mothurRemove(distFile);
}
delete input;
out.close();
out2.close();
- remove(filename.c_str());
+ m->mothurRemove(filename);
rename(tempNameFile.c_str(), filename.c_str());
return 0;
//read through the list file keeping any otus that contain any sequence from the groups selected
readListGroup();
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
if (outputNames.size() != 0) {
m->mothurOutEndLine();
//as long as you are not at the end of the file or done wih the lines you want
while((list != NULL) && (userLabels.size() != 0)) {
- if (m->control_pressed) { delete list; delete input; out.close(); outGroup.close(); remove(outputFileName.c_str()); remove(outputGroupFileName.c_str());return 0; }
+ if (m->control_pressed) { delete list; delete input; out.close(); outGroup.close(); m->mothurRemove(outputFileName); m->mothurRemove(outputGroupFileName);return 0; }
if(labels.count(list->getLabel()) == 1){
processList(list, groupMap, out, outGroup, wroteSomething);
}
- if (m->control_pressed) { if (list != NULL) { delete list; } delete input; out.close(); outGroup.close(); remove(outputFileName.c_str()); remove(outputGroupFileName.c_str()); return 0; }
+ if (m->control_pressed) { if (list != NULL) { delete list; } delete input; out.close(); outGroup.close(); m->mothurRemove(outputFileName); m->mothurRemove(outputGroupFileName); return 0; }
//output error messages about any remaining user labels
set<string>::iterator it;
set<string> processedLabels;
set<string> userLabels = labels;
- if (m->control_pressed) { outputTypes.clear(); out.close(); remove(filename.c_str()); delete rabund; delete input; return 0; }
+ if (m->control_pressed) { outputTypes.clear(); out.close(); m->mothurRemove(filename); delete rabund; delete input; return 0; }
while((rabund != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
if(allLines == 1 || labels.count(rabund->getLabel()) == 1){
m->mothurOut(rabund->getLabel()); m->mothurOutEndLine();
- if (m->control_pressed) { outputTypes.clear(); out.close(); remove(filename.c_str()); delete input; delete rabund; return 0; }
+ if (m->control_pressed) { outputTypes.clear(); out.close(); m->mothurRemove(filename); delete input; delete rabund; return 0; }
if(sorted) { rabund->print(out); }
else { rabund->nonSortedPrint(out); }
m->mothurOut(rabund->getLabel()); m->mothurOutEndLine();
- if (m->control_pressed) { outputTypes.clear(); out.close(); remove(filename.c_str()); delete input; delete rabund; return 0; }
+ if (m->control_pressed) { outputTypes.clear(); out.close(); m->mothurRemove(filename); delete input; delete rabund; return 0; }
if(sorted) { rabund->print(out); }
else { rabund->nonSortedPrint(out); }
m->mothurOut(rabund->getLabel()); m->mothurOutEndLine();
- if (m->control_pressed) { outputTypes.clear(); out.close(); remove(filename.c_str()); delete input; delete rabund; return 0; }
+ if (m->control_pressed) { outputTypes.clear(); out.close(); m->mothurRemove(filename); delete input; delete rabund; return 0; }
if(sorted) { rabund->print(out); }
else { rabund->nonSortedPrint(out); }
//as long as you are not at the end of the file or done wih the lines you want
while((lookup[0] != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
- if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; } m->Groups.clear(); delete input; out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; } m->Groups.clear(); delete input; out.close(); m->mothurRemove(outputFileName); return 0; }
if(allLines == 1 || labels.count(lookup[0]->getLabel()) == 1){
//prevent memory leak
for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; lookup[i] = NULL; }
- if (m->control_pressed) { outputTypes.clear(); m->Groups.clear(); delete input; out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { outputTypes.clear(); m->Groups.clear(); delete input; out.close(); m->mothurRemove(outputFileName); return 0; }
//get next line to process
lookup = input->getSharedRAbundVectors();
}
- if (m->control_pressed) { outputTypes.clear(); m->Groups.clear(); delete input; out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { outputTypes.clear(); m->Groups.clear(); delete input; out.close(); m->mothurRemove(outputFileName); return 0; }
//output error messages about any remaining user labels
set<string>::iterator it;
delete input;
out.close();
- if (m->control_pressed) { outputTypes.clear(); remove(outputFileName.c_str()); return 0;}
+ if (m->control_pressed) { outputTypes.clear(); m->mothurRemove(outputFileName); return 0;}
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
set<string> processedLabels;
set<string> userLabels = labels;
- if (m->control_pressed) { outputTypes.clear(); out.close(); remove(filename.c_str()); delete sabund; delete input; return 0; }
+ if (m->control_pressed) { outputTypes.clear(); out.close(); m->mothurRemove(filename); delete sabund; delete input; return 0; }
while((sabund != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
sabund->print(out);
- if (m->control_pressed) { outputTypes.clear(); out.close(); remove(filename.c_str()); delete sabund; delete input; return 0; }
+ if (m->control_pressed) { outputTypes.clear(); out.close(); m->mothurRemove(filename); delete sabund; delete input; return 0; }
processedLabels.insert(sabund->getLabel());
userLabels.erase(sabund->getLabel());
m->mothurOut(sabund->getLabel()); m->mothurOutEndLine();
sabund->print(out);
- if (m->control_pressed) { outputTypes.clear(); out.close(); remove(filename.c_str()); delete sabund; delete input; return 0; }
+ if (m->control_pressed) { outputTypes.clear(); out.close(); m->mothurRemove(filename); delete sabund; delete input; return 0; }
processedLabels.insert(sabund->getLabel());
userLabels.erase(sabund->getLabel());
sabund->print(out);
delete sabund;
- if (m->control_pressed) { outputTypes.clear(); out.close(); remove(filename.c_str()); delete input; return 0; }
+ if (m->control_pressed) { outputTypes.clear(); out.close(); m->mothurRemove(filename); delete input; return 0; }
}
if (qualfile != "") { readQual(); }
if (accnosfile2 != "") { compareAccnos(); }
- if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
- m->mothurOut("Selected " + toString(names.size()) + " sequences."); m->mothurOutEndLine();
if (outputNames.size() != 0) {
m->mothurOutEndLine();
string name;
bool wroteSomething = false;
+ int selectedCount = 0;
while(!in.eof()){
- if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outputFileName); return 0; }
Sequence currSeq(in);
name = currSeq.getName();
wroteSomething = true;
currSeq.printSequence(out);
+ selectedCount++;
}
}
m->gobble(in);
if (wroteSomething == false) { m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine(); }
outputNames.push_back(outputFileName); outputTypes["fasta"].push_back(outputFileName);
+ m->mothurOut("Selected " + toString(selectedCount) + " sequences from your fasta file."); m->mothurOutEndLine();
+
return 0;
}
string name;
bool wroteSomething = false;
+ int selectedCount = 0;
while(!in.eof()){
wroteSomething = true;
out << name << endl << scores;
+ selectedCount++;
}
m->gobble(in);
if (wroteSomething == false) { m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine(); }
outputNames.push_back(outputFileName); outputTypes["qfile"].push_back(outputFileName);
+ m->mothurOut("Selected " + toString(selectedCount) + " sequences from your quality file."); m->mothurOutEndLine();
+
+
return 0;
}
m->openInputFile(listfile, in);
bool wroteSomething = false;
+ int selectedCount = 0;
while(!in.eof()){
- if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outputFileName); return 0; }
//read in list vector
ListVector list(in);
binnames = binnames.substr(binnames.find_first_of(',')+1, binnames.length());
//if that name is in the .accnos file, add it
- if (names.count(name) != 0) { newNames += name + ","; }
+ if (names.count(name) != 0) { newNames += name + ","; selectedCount++; }
}
//get last name
- if (names.count(binnames) != 0) { newNames += binnames + ","; }
+ if (names.count(binnames) != 0) { newNames += binnames + ","; selectedCount++; }
//if there are names in this bin add to new list
if (newNames != "") {
if (wroteSomething == false) { m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine(); }
outputNames.push_back(outputFileName); outputTypes["list"].push_back(outputFileName);
+ m->mothurOut("Selected " + toString(selectedCount) + " sequences from your list file."); m->mothurOutEndLine();
+
return 0;
}
string name, firstCol, secondCol;
bool wroteSomething = false;
-
+ int selectedCount = 0;
while(!in.eof()){
- if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outputFileName); return 0; }
in >> firstCol;
in >> secondCol;
for (int i = 0; i < parsedNames.size(); i++) { names.insert(parsedNames[i]); }
out << firstCol << '\t' << hold << endl;
wroteSomething = true;
+ selectedCount += parsedNames.size();
}else {
+ selectedCount += validSecond.size();
+
//if the name in the first column is in the set then print it and any other names in second column also in set
if (names.count(firstCol) != 0) {
if (wroteSomething == false) { m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine(); }
outputNames.push_back(outputFileName); outputTypes["name"].push_back(outputFileName);
+ m->mothurOut("Selected " + toString(selectedCount) + " sequences from your name file."); m->mothurOutEndLine();
+
return 0;
}
string name, group;
bool wroteSomething = false;
+ int selectedCount = 0;
while(!in.eof()){
- if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outputFileName); return 0; }
in >> name; //read from first column
wroteSomething = true;
out << name << '\t' << group << endl;
+ selectedCount++;
}
m->gobble(in);
if (wroteSomething == false) { m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine(); }
outputNames.push_back(outputFileName); outputTypes["group"].push_back(outputFileName);
+ m->mothurOut("Selected " + toString(selectedCount) + " sequences from your group file."); m->mothurOutEndLine();
+
+
return 0;
}
string name, tax;
bool wroteSomething = false;
+ int selectedCount = 0;
while(!in.eof()){
- if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outputFileName); return 0; }
in >> name; //read from first column
in >> tax; //read from second column
wroteSomething = true;
out << name << '\t' << tax << endl;
+ selectedCount++;
}
m->gobble(in);
if (wroteSomething == false) { m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine(); }
outputNames.push_back(outputFileName); outputTypes["taxonomy"].push_back(outputFileName);
+
+ m->mothurOut("Selected " + toString(selectedCount) + " sequences from your taxonomy file."); m->mothurOutEndLine();
return 0;
string name, junk;
bool wroteSomething = false;
+ int selectedCount = 0;
//read column headers
for (int i = 0; i < 16; i++) {
while(!in.eof()){
- if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outputFileName); return 0; }
in >> name; //read from first column
//if this name is in the accnos file
if (names.count(name) != 0) {
wroteSomething = true;
+ selectedCount++;
out << name << '\t';
if (wroteSomething == false) { m->mothurOut("Your file does not contain any sequence from the .accnos file."); m->mothurOutEndLine(); }
outputNames.push_back(outputFileName); outputTypes["alignreport"].push_back(outputFileName);
+ m->mothurOut("Selected " + toString(selectedCount) + " sequences from your alignreport file."); m->mothurOutEndLine();
+
return 0;
}
if (m->control_pressed) {
if (lastlist != NULL) { delete lastlist; }
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear();
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear();
delete groupMap; return 0;
}
if (lastlist != NULL) { delete lastlist; }
- if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } delete groupMap; return 0; }
+ if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } delete groupMap; return 0; }
//set fasta file as new current fastafile
string current = "";
//go through each bin, find out if shared
for (int i = 0; i < shared->getNumBins(); i++) {
- if (m->control_pressed) { outNames.close(); remove(outputFileNames.c_str()); return 0; }
+ if (m->control_pressed) { outNames.close(); m->mothurRemove(outputFileNames); return 0; }
bool uniqueOTU = true;
outNames.close();
if (!wroteSomething) {
- remove(outputFileNames.c_str());
+ m->mothurRemove(outputFileNames);
string outputString = "\t" + toString(num) + " - No otus shared by groups";
string groupString = "";
in >> first >> second >> dist; m->gobble(in);
- if (m->control_pressed) { in.close(); out.close(); remove(tempDistFile.c_str()); return 0; }
+ if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(tempDistFile); return 0; }
//while there are still values in mergedMin that are smaller than the distance read from file
while (count < mergedMin.size()) {
mergedMin.clear();
//rename tempfile to distfile
- remove(distfile.c_str());
+ m->mothurRemove(distfile);
rename(tempDistFile.c_str(), distfile.c_str());
//cout << "remove = "<< renameOK << " rename = " << ok << endl;
//get entry
while (!in.eof()) {
- if (m->control_pressed) { in.close(); out.close(); remove(outTemp.c_str()); return 0; }
+ if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outTemp); return 0; }
in >> firstName >> secondName >> distance; m->gobble(in);
in.close();
out.close();
- remove(distfile.c_str());
+ m->mothurRemove(distfile);
rename(outTemp.c_str(), distfile.c_str());
return 0;
sabundFile.close();
rabundFile.close();
listFile.close();
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear();
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear();
return 0;
}
sabundFile.close();
rabundFile.close();
listFile.close();
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear();
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear();
return 0;
}
sabundFile.close();
rabundFile.close();
listFile.close();
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear();
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear();
return 0;
}
sabundFile.close();
rabundFile.close();
listFile.close();
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear();
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear();
return 0;
}
sabundFile.close();
rabundFile.close();
listFile.close();
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear();
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear();
return 0;
}
sabundFile.close();
rabundFile.close();
listFile.close();
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear();
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear();
return 0;
}
delete cluster;
if (m->control_pressed) {
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear();
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear();
return 0;
}
while((lookup[0] != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
if (m->control_pressed) {
for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; }
- for (int i = 0; i < outputNames.size(); i++) { if (outputNames[i] != "control") { remove(outputNames[i].c_str()); } } outputTypes.clear();
+ for (int i = 0; i < outputNames.size(); i++) { if (outputNames[i] != "control") { m->mothurRemove(outputNames[i]); } } outputTypes.clear();
m->Groups.clear();
delete input; delete heatmap; return 0;
}
if (m->control_pressed) {
- for (int i = 0; i < outputNames.size(); i++) { if (outputNames[i] != "control") { remove(outputNames[i].c_str()); } } outputTypes.clear();
+ for (int i = 0; i < outputNames.size(); i++) { if (outputNames[i] != "control") { m->mothurRemove(outputNames[i]); } } outputTypes.clear();
m->Groups.clear();
delete input; delete heatmap; return 0;
}
while((rabund != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
if (m->control_pressed) {
- for (int i = 0; i < outputNames.size(); i++) { if (outputNames[i] != "control") { remove(outputNames[i].c_str()); } } outputTypes.clear();
+ for (int i = 0; i < outputNames.size(); i++) { if (outputNames[i] != "control") { m->mothurRemove(outputNames[i]); } } outputTypes.clear();
delete rabund; delete input; delete heatmap; return 0;
}
}
if (m->control_pressed) {
- for (int i = 0; i < outputNames.size(); i++) { if (outputNames[i] != "control") { remove(outputNames[i].c_str()); } } outputTypes.clear();
+ for (int i = 0; i < outputNames.size(); i++) { if (outputNames[i] != "control") { m->mothurRemove(outputNames[i]); } } outputTypes.clear();
delete input; delete heatmap; return 0;
}
while((lookupFloat[0] != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
if (m->control_pressed) {
for (int i = 0; i < lookupFloat.size(); i++) { delete lookupFloat[i]; }
- for (int i = 0; i < outputNames.size(); i++) { if (outputNames[i] != "control") { remove(outputNames[i].c_str()); } } outputTypes.clear();
+ for (int i = 0; i < outputNames.size(); i++) { if (outputNames[i] != "control") { m->mothurRemove(outputNames[i]); } } outputTypes.clear();
m->Groups.clear();
delete input; delete heatmap; return 0;
}
if (m->control_pressed) {
- for (int i = 0; i < outputNames.size(); i++) { if (outputNames[i] != "control") { remove(outputNames[i].c_str()); } } outputTypes.clear();
+ for (int i = 0; i < outputNames.size(); i++) { if (outputNames[i] != "control") { m->mothurRemove(outputNames[i]); } } outputTypes.clear();
m->Groups.clear();
delete input; delete heatmap; return 0;
}
delete heatmap;
if (m->control_pressed) {
- for (int i = 0; i < outputNames.size(); i++) { if (outputNames[i] != "control") { remove(outputNames[i].c_str()); } } outputTypes.clear(); return 0;
+ for (int i = 0; i < outputNames.size(); i++) { if (outputNames[i] != "control") { m->mothurRemove(outputNames[i]); } } outputTypes.clear(); return 0;
}
m->mothurOutEndLine();
delete heatmap;
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear(); return 0; }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear(); return 0; }
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
if (sharedfile != "") { for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; } }
else { for (int i = 0; i < lookupFloat.size(); i++) { delete lookupFloat[i]; } }
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
//set tree file as new current treefile
if (treefile != "") {
in >> numTemp; m->gobble(in);
pvalues[j] += numTemp;
}
- in.close(); remove(tempFile.c_str());
+ in.close(); m->mothurRemove(tempFile);
}
for (int i = 0; i < pvalues.size(); i++) { pvalues[i] /= (double)iters; }
}
in >> numTemp; m->gobble(in);
pvalues[j] += numTemp;
}
- in.close(); remove(tempFile.c_str());
+ in.close(); m->mothurRemove(tempFile);
}
for (int i = 0; i < pvalues.size(); i++) { pvalues[i] /= (double)iters; }
}
m->openOutputFile(newGroupFile, outGroups);
for (int i = 0; i < matrix->getNumSeqs(); i++) {
- if (m->control_pressed) { delete groupMap; delete matrix; outGroups.close(); remove(newGroupFile.c_str()); return 0; }
+ if (m->control_pressed) { delete groupMap; delete matrix; outGroups.close(); m->mothurRemove(newGroupFile); return 0; }
Names temp = matrix->getRowInfo(i);
outGroups << temp.seqName << '\t' << temp.groupName << endl;
groupMap = new GroupMap(groupfile);
groupMap->readMap();
- if (m->control_pressed) { delete groupMap; delete matrix; remove(newGroupFile.c_str()); return 0; }
+ if (m->control_pressed) { delete groupMap; delete matrix; m->mothurRemove(newGroupFile); return 0; }
}
delete matrix; delete groupMap;
- if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
//output to .accnos file
for (int i = 0; i < names.size(); i++) {
- if (m->control_pressed) { outputTypes.clear(); out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { outputTypes.clear(); out.close(); m->mothurRemove(outputFileName); return 0; }
out << names[i] << endl;
}
out.close();
- if (m->control_pressed) { outputTypes.clear(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { outputTypes.clear(); m->mothurRemove(outputFileName); return 0; }
m->setAccnosFile(outputFileName);
qFile.close();
out.close();
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
for (int i = 0; i < fastaFileNames.size(); i++) {
- if (m->control_pressed) { outputTypes.clear(); out.close(); remove(filename.c_str()); return 0; }
+ if (m->control_pressed) { outputTypes.clear(); out.close(); m->mothurRemove(filename); return 0; }
ifstream in;
m->openInputFile(fastaFileNames[i], in);
Sequence seq(in, "no align"); m->gobble(in);
- if (m->control_pressed) { outputTypes.clear(); in.close(); out.close(); remove(filename.c_str()); return 0; }
+ if (m->control_pressed) { outputTypes.clear(); in.close(); out.close(); m->mothurRemove(filename); return 0; }
if (seq.getName() != "") { out << seq.getName() << '\t' << groupsNames[i] << endl; }
}
//as long as you are not at the end of the file or done wih the lines you want
while((lookup[0] != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
- if (m->control_pressed) { outputTypes.clear(); delete input; for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; } for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } m->Groups.clear(); return 0; }
+ if (m->control_pressed) { outputTypes.clear(); delete input; for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; } for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } m->Groups.clear(); return 0; }
if(allLines == 1 || labels.count(lookup[0]->getLabel()) == 1){
m->mothurOut(lookup[0]->getLabel()); m->mothurOutEndLine();
lookup = input->getSharedRAbundVectors();
}
- if (m->control_pressed) { outputTypes.clear(); delete input; for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } m->Groups.clear(); return 0; }
+ if (m->control_pressed) { outputTypes.clear(); delete input; for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } m->Groups.clear(); return 0; }
//output error messages about any remaining user labels
set<string>::iterator it;
}
}
- if (m->control_pressed) { outputTypes.clear(); delete input; for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } m->Groups.clear(); return 0; }
+ if (m->control_pressed) { outputTypes.clear(); delete input; for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } m->Groups.clear(); return 0; }
//run last label if you need to
if (needToRun == true) {
for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; }
}
- if (m->control_pressed) { outputTypes.clear(); delete input; for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } m->Groups.clear(); return 0; }
+ if (m->control_pressed) { outputTypes.clear(); delete input; for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } m->Groups.clear(); return 0; }
//reset groups parameter
m->Groups.clear();
}
}
intemp.close();
- remove(tempdistFileName.c_str());
+ m->mothurRemove(tempdistFileName);
}
}
m->openInputFile(fileNames[i], inputFile);
while(!inputFile.eof()){
- if (m->control_pressed) { outputTypes.clear(); inputFile.close(); outputFile.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { outputTypes.clear(); inputFile.close(); outputFile.close(); m->mothurRemove(outputFileName); return 0; }
c = inputFile.get();
//-1 is eof char
outputFile.close();
- if (m->control_pressed) { outputTypes.clear(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { outputTypes.clear(); m->mothurRemove(outputFileName); return 0; }
m->mothurOutEndLine();
m->mothurOut("Output File Name: "); m->mothurOutEndLine();
//as long as you are not at the end of the file or done wih the lines you want
while((lookup[0] != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
- if (m->control_pressed) { out.close(); for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; } m->Groups.clear(); delete designMap; for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { out.close(); for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; } m->Groups.clear(); delete designMap; for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
if(allLines == 1 || labels.count(lookup[0]->getLabel()) == 1){
//prevent memory leak
for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; lookup[i] = NULL; }
- if (m->control_pressed) { out.close(); m->Groups.clear(); delete designMap; for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { out.close(); m->Groups.clear(); delete designMap; for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
//get next line to process
lookup = input.getSharedRAbundVectors();
}
- if (m->control_pressed) { out.close(); m->Groups.clear(); delete designMap; for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { out.close(); m->Groups.clear(); delete designMap; for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
//output error messages about any remaining user labels
set<string>::iterator it;
m->Groups.clear();
delete designMap;
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0;}
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0;}
//set shared file as new current sharedfile
ratio[i]=total[i]/min;
}
- // Change matrix into an array as received by R for compatibility.
+ //Change matrix into an array as received by R for compatibility.
c=0;
for(i=0;i<col;i++){
prt=&prt1;
pre=&pre1;
+ //MothurFisher fishtere;
+ //double mothurFex = fishtere.fexact(f11, f12, f21, f22);
+
fexact(nr,nc,data, ldtabl,expect,prc,emin,prt,pre,work);
if (*pre>.999999999){
*pre=1;
}
+
+ //printf("feaxt = %f\t%f\t%f\t%f\t%f\t%f\n", *expect, *pre, f11, f12, f21, f22);
storage[i][8] = *pre;
pvalues[i]=*pre;
}
#include "metastatscommand.h"
#include "metastats.h"
#include "sharedutilities.h"
+#include "mothurmetastats.h"
//**********************************************************************************************************************
vector<string> MetaStatsCommand::setParameters(){
//as long as you are not at the end of the file or done wih the lines you want
while((lookup[0] != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
- if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; } m->Groups.clear(); delete input; delete designMap; for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; } m->Groups.clear(); delete input; delete designMap; for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
if(allLines == 1 || labels.count(lookup[0]->getLabel()) == 1){
//prevent memory leak
for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; lookup[i] = NULL; }
- if (m->control_pressed) { outputTypes.clear(); m->Groups.clear(); delete input; delete designMap; for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { outputTypes.clear(); m->Groups.clear(); delete input; delete designMap; for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
//get next line to process
lookup = input->getSharedRAbundVectors();
}
- if (m->control_pressed) { outputTypes.clear(); m->Groups.clear(); delete input; delete designMap; for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { outputTypes.clear(); m->Groups.clear(); delete input; delete designMap; for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
//output error messages about any remaining user labels
set<string>::iterator it;
delete input;
delete designMap;
- if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0;}
+ if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0;}
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
double** data;
data = new double*[thisLookUp[0]->getNumBins()];
+ vector< vector<double> > data2; data2.resize(thisLookUp[0]->getNumBins());
+
vector<SharedRAbundVector*> subset;
int setACount = 0;
int setBCount = 0;
//fill data
for (int j = 0; j < thisLookUp[0]->getNumBins(); j++) {
data[j] = new double[subset.size()];
+ data2[j].resize(subset.size(), 0.0);
for (int i = 0; i < subset.size(); i++) {
data[j][i] = (subset[i]->getAbundance(j));
+ data2[j][i] = (subset[i]->getAbundance(j));
}
}
m->mothurOut("Comparing " + setA + " and " + setB + "..."); m->mothurOutEndLine();
metastat_main(output, thisLookUp[0]->getNumBins(), subset.size(), threshold, iters, data, setACount);
+ m->mothurOutEndLine();
+ MothurMetastats mothurMeta(threshold, iters);
+ mothurMeta.runMetastats(outputFileName+".myVersion" , data2, setACount);
+ m->mothurOutEndLine();
+
m->mothurOutEndLine();
}
if (m->control_pressed) {
delete nameMap; delete read; delete list; delete rabund;
- listFile.close(); rabundFile.close(); sabundFile.close(); remove((fileroot+ tag + ".list").c_str()); remove((fileroot+ tag + ".rabund").c_str()); remove((fileroot+ tag + ".sabund").c_str());
+ listFile.close(); rabundFile.close(); sabundFile.close(); m->mothurRemove((fileroot+ tag + ".list")); m->mothurRemove((fileroot+ tag + ".rabund")); m->mothurRemove((fileroot+ tag + ".sabund"));
outputTypes.clear();
return 0;
}
if (m->control_pressed) {
delete nameMap; delete distMatrix; delete list; delete rabund; delete cluster;
- listFile.close(); rabundFile.close(); sabundFile.close(); remove((fileroot+ tag + ".list").c_str()); remove((fileroot+ tag + ".rabund").c_str()); remove((fileroot+ tag + ".sabund").c_str());
+ listFile.close(); rabundFile.close(); sabundFile.close(); m->mothurRemove((fileroot+ tag + ".list")); m->mothurRemove((fileroot+ tag + ".rabund")); m->mothurRemove((fileroot+ tag + ".sabund"));
outputTypes.clear();
return 0;
}
if (m->control_pressed) {
delete nameMap; delete distMatrix; delete list; delete rabund; delete cluster;
- listFile.close(); rabundFile.close(); sabundFile.close(); remove((fileroot+ tag + ".list").c_str()); remove((fileroot+ tag + ".rabund").c_str()); remove((fileroot+ tag + ".sabund").c_str());
+ listFile.close(); rabundFile.close(); sabundFile.close(); m->mothurRemove((fileroot+ tag + ".list")); m->mothurRemove((fileroot+ tag + ".rabund")); m->mothurRemove((fileroot+ tag + ".sabund"));
outputTypes.clear();
return 0;
}
if (m->control_pressed) {
delete nameMap; delete distMatrix; delete list; delete rabund; delete cluster; delete temp;
- listFile.close(); rabundFile.close(); sabundFile.close(); remove((fileroot+ tag + ".list").c_str()); remove((fileroot+ tag + ".rabund").c_str()); remove((fileroot+ tag + ".sabund").c_str());
+ listFile.close(); rabundFile.close(); sabundFile.close(); m->mothurRemove((fileroot+ tag + ".list")); m->mothurRemove((fileroot+ tag + ".rabund")); m->mothurRemove((fileroot+ tag + ".sabund"));
outputTypes.clear();
return 0;
}
if (m->control_pressed) {
delete nameMap; delete distMatrix; delete list; delete rabund; delete cluster; delete temp;
- listFile.close(); rabundFile.close(); sabundFile.close(); remove((fileroot+ tag + ".list").c_str()); remove((fileroot+ tag + ".rabund").c_str()); remove((fileroot+ tag + ".sabund").c_str());
+ listFile.close(); rabundFile.close(); sabundFile.close(); m->mothurRemove((fileroot+ tag + ".list")); m->mothurRemove((fileroot+ tag + ".rabund")); m->mothurRemove((fileroot+ tag + ".sabund"));
outputTypes.clear();
return 0;
}
if (m->control_pressed) {
delete nameMap; delete list; delete rabund;
- listFile.close(); rabundFile.close(); sabundFile.close(); remove((fileroot+ tag + ".list").c_str()); remove((fileroot+ tag + ".rabund").c_str()); remove((fileroot+ tag + ".sabund").c_str());
+ listFile.close(); rabundFile.close(); sabundFile.close(); m->mothurRemove((fileroot+ tag + ".list")); m->mothurRemove((fileroot+ tag + ".rabund")); m->mothurRemove((fileroot+ tag + ".sabund"));
outputTypes.clear();
return 0;
}
if (m->control_pressed) {
delete nameMap; delete list; delete rabund; delete hcluster;
- listFile.close(); rabundFile.close(); sabundFile.close(); remove((fileroot+ tag + ".list").c_str()); remove((fileroot+ tag + ".rabund").c_str()); remove((fileroot+ tag + ".sabund").c_str());
+ listFile.close(); rabundFile.close(); sabundFile.close(); m->mothurRemove((fileroot+ tag + ".list")); m->mothurRemove((fileroot+ tag + ".rabund")); m->mothurRemove((fileroot+ tag + ".sabund"));
outputTypes.clear();
return 0;
}
if (m->control_pressed) {
delete nameMap; delete list; delete rabund; delete hcluster;
- listFile.close(); rabundFile.close(); sabundFile.close(); remove((fileroot+ tag + ".list").c_str()); remove((fileroot+ tag + ".rabund").c_str()); remove((fileroot+ tag + ".sabund").c_str());
- remove(distFile.c_str());
- remove(overlapFile.c_str());
+ listFile.close(); rabundFile.close(); sabundFile.close(); m->mothurRemove((fileroot+ tag + ".list")); m->mothurRemove((fileroot+ tag + ".rabund")); m->mothurRemove((fileroot+ tag + ".sabund"));
+ m->mothurRemove(distFile);
+ m->mothurRemove(overlapFile);
outputTypes.clear();
return 0;
}
if (m->control_pressed) {
delete nameMap; delete list; delete rabund; delete hcluster;
- listFile.close(); rabundFile.close(); sabundFile.close(); remove((fileroot+ tag + ".list").c_str()); remove((fileroot+ tag + ".rabund").c_str()); remove((fileroot+ tag + ".sabund").c_str());
- remove(distFile.c_str());
- remove(overlapFile.c_str());
+ listFile.close(); rabundFile.close(); sabundFile.close(); m->mothurRemove((fileroot+ tag + ".list")); m->mothurRemove((fileroot+ tag + ".rabund")); m->mothurRemove((fileroot+ tag + ".sabund"));
+ m->mothurRemove(distFile);
+ m->mothurRemove(overlapFile);
outputTypes.clear();
return 0;
}
if (m->control_pressed) {
delete nameMap; delete list; delete rabund; delete hcluster; delete temp;
- listFile.close(); rabundFile.close(); sabundFile.close(); remove((fileroot+ tag + ".list").c_str()); remove((fileroot+ tag + ".rabund").c_str()); remove((fileroot+ tag + ".sabund").c_str());
- remove(distFile.c_str());
- remove(overlapFile.c_str());
+ listFile.close(); rabundFile.close(); sabundFile.close(); m->mothurRemove((fileroot+ tag + ".list")); m->mothurRemove((fileroot+ tag + ".rabund")); m->mothurRemove((fileroot+ tag + ".sabund"));
+ m->mothurRemove(distFile);
+ m->mothurRemove(overlapFile);
outputTypes.clear();
return 0;
}
if (m->control_pressed) {
delete nameMap; delete list; delete rabund; delete hcluster; delete temp;
- listFile.close(); rabundFile.close(); sabundFile.close(); remove((fileroot+ tag + ".list").c_str()); remove((fileroot+ tag + ".rabund").c_str()); remove((fileroot+ tag + ".sabund").c_str());
- remove(distFile.c_str());
- remove(overlapFile.c_str());
+ listFile.close(); rabundFile.close(); sabundFile.close(); m->mothurRemove((fileroot+ tag + ".list")); m->mothurRemove((fileroot+ tag + ".rabund")); m->mothurRemove((fileroot+ tag + ".sabund"));
+ m->mothurRemove(distFile);
+ m->mothurRemove(overlapFile);
outputTypes.clear();
return 0;
}
}
delete hcluster;
- remove(distFile.c_str());
- remove(overlapFile.c_str());
+ m->mothurRemove(distFile);
+ m->mothurRemove(overlapFile);
}
delete list;
if (m->control_pressed) {
delete nameMap;
- listFile.close(); rabundFile.close(); sabundFile.close(); remove((fileroot+ tag + ".list").c_str()); remove((fileroot+ tag + ".rabund").c_str()); remove((fileroot+ tag + ".sabund").c_str());
+ listFile.close(); rabundFile.close(); sabundFile.close(); m->mothurRemove((fileroot+ tag + ".list")); m->mothurRemove((fileroot+ tag + ".rabund")); m->mothurRemove((fileroot+ tag + ".sabund"));
outputTypes.clear();
return 0;
}
try {
//sort distFile
string sortedDistFile = m->sortFile(unsortedDist, outputDir);
- remove(unsortedDist.c_str()); //delete unsorted file
+ m->mothurRemove(unsortedDist); //delete unsorted file
distFile = sortedDistFile;
//sort overlap file
string sortedOverlapFile = m->sortFile(unsortedOverlap, outputDir);
- remove(unsortedOverlap.c_str()); //delete unsorted file
+ m->mothurRemove(unsortedOverlap); //delete unsorted file
overlapFile = sortedOverlapFile;
}
catch(exception& e) {
outNewLog.close();
m->appendFiles(logFileName, newlogFileName);
- remove(logFileName.c_str());
+ m->mothurRemove(logFileName);
}
}else{
newlogFileName = outputDir + logFileName;
--- /dev/null
+/*
+ * mothurfisher.cpp
+ * Mothur
+ *
+ * Created by westcott on 7/8/11.
+ * Copyright 2011 Schloss Lab. All rights reserved.
+ *
+ */
+
+//translated to c++ using source code http://www.langsrud.com/stat/fisher.htm as a reference
+
+#include "mothurfisher.h"
+/***********************************************************/
+double MothurFisher::fexact(double n11_, double n12_, double n21_, double n22_) {
+ try {
+ sleft = 0.0; sright = 0.0; sless = 0.0; slarg = 0.0;
+
+ if(n11_<0) n11_ *= -1;
+ if(n12_<0) n12_ *= -1;
+ if(n21_<0) n21_ *= -1;
+ if(n22_<0) n22_ *= -1;
+
+ double n1_ = n11_+n12_;
+ double n_1 = n11_+n21_;
+ double n = n11_ +n12_ +n21_ +n22_;
+ exact(n11_,n1_,n_1,n);
+ double twotail = sleft+sright;
+
+ if(twotail>1) twotail=1;
+ double result = twotail;
+ return result;
+
+ }catch(exception& e) {
+ m->errorOut(e, "MothurFisher", "fexact");
+ exit(1);
+ }
+}
+/***********************************************************/
+double MothurFisher::lngamm(double z) {
+ // Reference: "Lanczos, C. 'A precision approximation
+ // of the gamma function', J. SIAM Numer. Anal., B, 1, 86-96, 1964."
+ // Translation of Alan Miller's FORTRAN-implementation
+ // See http://lib.stat.cmu.edu/apstat/245
+ try {
+ double x = 0;
+ x += 0.1659470187408462e-06/(z+7);
+ x += 0.9934937113930748e-05/(z+6);
+ x -= 0.1385710331296526 /(z+5);
+ x += 12.50734324009056 /(z+4);
+ x -= 176.6150291498386 /(z+3);
+ x += 771.3234287757674 /(z+2);
+ x -= 1259.139216722289 /(z+1);
+ x += 676.5203681218835 /(z);
+ x += 0.9999999999995183;
+
+ return(log(x)-5.58106146679532777-z+(z-0.5)*log(z+6.5));
+
+ }catch(exception& e) {
+ m->errorOut(e, "MothurFisher", "lngamm");
+ exit(1);
+ }
+}
+
+/***********************************************************/
+double MothurFisher::lnfact(double n){
+ try {
+ if(n <= 1) return(0);
+ return(lngamm(n+1));
+ }catch(exception& e) {
+ m->errorOut(e, "MothurFisher", "lnfact");
+ exit(1);
+ }
+}
+/***********************************************************/
+double MothurFisher::lnbico(double n, double k){
+ try {
+ return(lnfact(n)-lnfact(k)-lnfact(n-k));
+ }catch(exception& e) {
+ m->errorOut(e, "MothurFisher", "lnbico");
+ exit(1);
+ }
+}
+/***********************************************************/
+double MothurFisher::hyper_323(double n11, double n1_, double n_1, double n){
+ try {
+ return(exp(lnbico(n1_,n11)+lnbico(n-n1_,n_1-n11)-lnbico(n,n_1)));
+ }catch(exception& e) {
+ m->errorOut(e, "MothurFisher", "hyper_323");
+ exit(1);
+ }
+}
+/***********************************************************/
+//var sn11,sn1_,sn_1,sn,sprob;
+double MothurFisher::hyper(double n11){
+ try {
+ return(hyper0(n11,0,0,0));
+ }catch(exception& e) {
+ m->errorOut(e, "MothurFisher", "hyper");
+ exit(1);
+ }
+}
+/***********************************************************/
+double MothurFisher::hyper0(double n11i, double n1_i, double n_1i, double ni) {
+ try {
+ if (!((n1_i != 0)&&(n_1i != 0)&&(ni != 0))) {
+ if(!(((int)n11i % 10) == 0)){
+ if(n11i==sn11+1)
+ {
+ sprob *= ((sn1_-sn11)/(n11i))*((sn_1-sn11)/(n11i+sn-sn1_-sn_1));
+ sn11 = n11i;
+ return sprob;
+ }
+ if(n11i==sn11-1)
+ {
+ sprob *= ((sn11)/(sn1_-n11i))*((sn11+sn-sn1_-sn_1)/(sn_1-n11i));
+ sn11 = n11i;
+ return sprob;
+ }
+ }
+ sn11 = n11i;
+ }else{
+ sn11 = n11i;
+ sn1_=n1_i;
+ sn_1=n_1i;
+ sn=ni;
+ }
+
+ sprob = hyper_323(sn11,sn1_,sn_1,sn);
+ return sprob;
+
+ }catch(exception& e) {
+ m->errorOut(e, "MothurFisher", "hyper0");
+ exit(1);
+ }
+}
+/***********************************************************/
+double MothurFisher::exact(double n11, double n1_, double n_1, double n){
+ try {
+ double p,i,j,prob;
+ double max=n1_;
+ if(n_1<max) max=n_1;
+ double min = n1_+n_1-n;
+ if(min<0) min=0;
+ if(min==max)
+ {
+ sless = 1;
+ sright= 1;
+ sleft = 1;
+ slarg = 1;
+ return 1;
+ }
+ prob=hyper0(n11,n1_,n_1,n);
+ sleft=0;
+ p=hyper(min);
+ for(i=min+1; p<0.99999999*prob; i++)
+ {
+ sleft += p;
+ p=hyper(i);
+ }
+ i--;
+ if(p<1.00000001*prob) sleft += p;
+ else i--;
+ sright=0;
+ p=hyper(max);
+ for(j=max-1; p<0.99999999*prob; j--)
+ {
+ sright += p;
+ p=hyper(j);
+ }
+ j++;
+ if(p<1.00000001*prob) sright += p;
+ else j++;
+ if(abs(i-n11)<abs(j-n11))
+ {
+ sless = sleft;
+ slarg = 1 - sleft + prob;
+ }
+ else
+ {
+ sless = 1 - sright + prob;
+ slarg = sright;
+ }
+ return prob;
+
+ }catch(exception& e) {
+ m->errorOut(e, "MothurFisher", "hyper0");
+ exit(1);
+ }
+}
+/***********************************************************/
+
+
+
--- /dev/null
+#ifndef MOTHUR_FISHER
+#define MOTHUR_FISHER
+
+/*
+ * mothurfisher.h
+ * Mothur
+ *
+ * Created by westcott on 7/8/11.
+ * Copyright 2011 Schloss Lab. All rights reserved.
+ *
+ */
+
+
+#include "mothurout.h"
+
+class MothurFisher {
+
+public:
+ MothurFisher(){}
+ ~MothurFisher(){}
+
+ double fexact(double, double, double, double);
+
+private:
+ MothurOut* m;
+ double sleft, sright, sless, slarg;
+ double sn11,sn1_,sn_1,sn,sprob;
+ double lngamm(double);
+ double lnfact(double);
+ double lnbico(double, double);
+ double hyper_323(double, double, double, double);
+ double hyper(double);
+ double hyper0(double, double, double, double);
+ double exact(double, double, double, double);
+};
+
+
+#endif
+
--- /dev/null
+/*
+ * mothurmetastats.cpp
+ * Mothur
+ *
+ * Created by westcott on 7/6/11.
+ * Copyright 2011 Schloss Lab. All rights reserved.
+ *
+ */
+
+#include "mothurmetastats.h"
+#include "mothurfisher.h"
+
+/***********************************************************/
+MothurMetastats::MothurMetastats(double t, int n) {
+ try {
+ m = MothurOut::getInstance();
+ threshold = t;
+ numPermutations = n;
+
+ }catch(exception& e) {
+ m->errorOut(e, "MothurMetastats", "MothurMetastats");
+ exit(1);
+ }
+}
+/***********************************************************/
+MothurMetastats::~MothurMetastats() {
+ try {
+
+
+ }catch(exception& e) {
+ m->errorOut(e, "MothurMetastats", "~MothurMetastats");
+ exit(1);
+ }
+}
+/***********************************************************/
+//main metastats function
+int MothurMetastats::runMetastats(string outputFileName, vector< vector<double> >& data, int secondGroupingStart) {
+ try {
+ int bflag = 0;
+ row = data.size(); //numBins
+ column = data[0].size(); //numGroups in subset
+ int size = row*column;
+
+ //consistent with original, but this should never be true
+ if ((secondGroupingStart >= column) || (secondGroupingStart <= 0)) { m->mothurOut("[ERROR]: Check your g value."); m->mothurOutEndLine(); return 0; }
+
+ //Initialize the matrices
+ vector<double> pmatrix; pmatrix.resize(size, 0.0);
+ vector<double> permuted; permuted.resize(size, 0.0);
+ vector< vector<double> > storage; storage.resize(row);
+ for (int i = 0; i < storage.size(); i++) { storage[i].resize(9, 0.0); }
+
+ //Produces the sum of each column
+ vector<double> total; total.resize(column, 0.0);
+ vector<double> ratio; ratio.resize(column, 0.0);
+ double total1 = 0.0; double total2 = 0.0;
+
+ //total[i] = total abundance for group[i]
+ for (int i = 0; i < column; i++) {
+ for (int j = 0; j < row; j++) {
+ total[i] += data[j][i];
+ }
+ }
+
+ //total for first grouping
+ for (int i = 0; i < (secondGroupingStart-1); i++) { total1 += total[i]; }
+
+ //total for second grouping
+ for (int i = (secondGroupingStart-1); i < column; i++) { total2 += total[i]; }
+
+ //Creates the ratios by first finding the minimum of totals
+ double min = total[0];
+ for (int i = 0; i < total.size(); i++) {
+ if (total[i] < min) { min = total[i]; }
+ }
+
+ //sanity check
+ if (min <= 0.0) { m->mothurOut("[ERROR]: the sum of one of the columns <= 0."); m->mothurOutEndLine(); return 0; }
+
+ //Ratio time...
+ for(int i = 0; i < ratio.size(); i++){ ratio[i] = total[i] / min; }
+
+ //Change matrix into an array as received by R for compatibility - kept to be consistent with original
+ int count = 0;
+ for(int i = 0; i < column; i++){
+ for(int j = 0; j < row; j++){
+ pmatrix[count]=data[j][i];
+ count++;
+ }
+ }
+
+ if(row == 1){
+ for (int i =0; i < column; i++){ pmatrix[i] /= ratio[i]; }
+ }else {
+ count = 0; int j=-1;
+
+ for (int i=0; i < size; i++) {
+ if (count % row == 0) { j++; }
+ pmatrix[i] /= ratio[j];
+ count++;
+ }
+ }
+
+ vector<double> permuted_ttests; permuted_ttests.resize(row, 0.0);
+ vector<double> pvalues; pvalues.resize(row, 0.0);
+ vector<double> tinitial; tinitial.resize(row, 0.0);
+
+ if (m->control_pressed) { return 1; }
+
+ //Find the initial values for the matrix.
+ start(pmatrix, secondGroupingStart, tinitial, storage);
+
+ if (m->control_pressed) { return 1; }
+
+ // Start the calculations.
+ if ( (column == 2) || ((secondGroupingStart-1) < 8) || ((column-secondGroupingStart+1) < 8) ){
+
+ vector<double> fish; fish.resize(row, 0.0);
+ vector<double> fish2; fish2.resize(row, 0.0);
+
+ for(int i = 0; i < row; i++){
+
+ for(int j = 0; j < (secondGroupingStart-1); j++) { fish[i] += data[i][j]; }
+ for(int j = (secondGroupingStart-1); j < column; j++) { fish2[i] += data[i][j]; }
+
+ //vector<double> tempData; tempData.resize(4, 0.0);
+ double f11, f12, f21, f22;
+ f11 = fish[i];
+ f12 = fish2[i];
+ f21 = total1 - fish[i];
+ f22 = total2 - fish2[i];
+
+ double pre = 0.0;
+
+ MothurFisher fisher;
+ pre = fisher.fexact(f11, f12, f21, f22);
+
+ if (m->control_pressed) { return 1; }
+
+ if (pre > 0.999999999) { pre = 1.0; }
+ storage[i][8] = pre;
+ pvalues[i] = pre;
+ }
+
+ }else {
+
+ testp(permuted_ttests, permuted, pmatrix, secondGroupingStart, tinitial, pvalues);
+
+ if (m->control_pressed) { return 1; }
+
+ // Checks to make sure the matrix isn't sparse.
+ vector<double> sparse; sparse.resize(row, 0.0);
+ vector<double> sparse2; sparse2.resize(row, 0.0);
+
+ int c = 0;
+
+ for(int i = 0; i < row; i++){
+
+ for(int j = 0; j < (secondGroupingStart-1); j++){ sparse[i] += data[i][j]; }
+ if(sparse[i] < (double)(secondGroupingStart-1)){ c++; }
+
+ // ?<= for col
+ for(int j = (secondGroupingStart-1); j < column; j++){ sparse2[i] += data[i][j]; }
+ if( (sparse2[i] < (double)(column-secondGroupingStart+1))) { c++; }
+
+ if (c == 2) {
+ c=0;
+ double f11,f12,f21,f22;
+
+ f11=sparse[i]; sparse[i]=0;
+ f12=sparse2[i]; sparse2[i]=0;
+ f21 = total1 - f11;
+ f22 = total2 - f12;
+
+ double pre = 0.0;
+
+ MothurFisher fisher;
+ pre = fisher.fexact(f11, f12, f21, f22);
+
+ if (m->control_pressed) { return 1; }
+
+ if (pre > 0.999999999){
+ pre = 1.0;
+ }
+
+ storage[i][8] = pre;
+ pvalues[i] = pre;
+ }
+ }
+
+ bflag = 1;
+ }
+
+ // Calculates the mean of counts (not normalized)
+ vector< vector<double> > temp; temp.resize(row);
+ for (int i = 0; i < temp.size(); i++) { temp[i].resize(2, 0.0); }
+
+ for (int j = 0; j < row; j++){
+ if (m->control_pressed) { return 1; }
+
+ for (int i = 1; i <= (secondGroupingStart-1); i++){ temp[j][0] += data[j][i-1]; }
+ temp[j][0] /= (double)(secondGroupingStart-1);
+
+ for(int i = secondGroupingStart; i <= column; i++){ temp[j][1] += data[j][i-1]; }
+ temp[j][1] /= (double)(column-secondGroupingStart+1);
+ }
+
+ for(int i = 0; i < row; i++){
+ if (m->control_pressed) { return 1; }
+
+ storage[i][3]=temp[i][0];
+ storage[i][7]=temp[i][1];
+ storage[i][8]=pvalues[i];
+ }
+
+ // BACKUP checks
+ cout.setf(ios::fixed, ios::floatfield); cout.setf(ios::showpoint);
+ for (int i = 0; i < row; i++){
+
+ if (m->control_pressed) { return 1; }
+
+ if(pvalues[i] < threshold){
+ m->mothurOut("Feature " + toString((i+1)) + " is significant, p = ");
+ cout << pvalues[i];
+ m->mothurOutJustToLog(toString(pvalues[i])); m->mothurOutEndLine();
+ }
+ }
+
+ // And now we write the files to a text file.
+ struct tm *local;
+ time_t t; t = time(NULL);
+ local = localtime(&t);
+
+ ofstream out;
+ m->openOutputFile(outputFileName, out);
+ out.setf(ios::fixed, ios::floatfield); out.setf(ios::showpoint);
+
+ out << "Local time and date of test: " << asctime(local) << endl;
+ out << "# rows = " << row << ", # col = " << column << ", g = " << secondGroupingStart << endl << endl;
+ if (bflag == 1){ out << numPermutations << " permutations" << endl << endl; }
+
+ //output column headings - not really sure... documentation labels 9 columns, there are 10 in the output file
+ //storage 0 = meanGroup1 - line 529, 1 = varGroup1 - line 532, 2 = err rate1 - line 534, 3 = mean of counts group1?? - line 291, 4 = meanGroup2 - line 536, 5 = varGroup2 - line 539, 6 = err rate2 - line 541, 7 = mean of counts group2?? - line 292, 8 = pvalues - line 293
+ out << "OTU\tmean(group1)\tvariance(group1)\tstderr(group1)\tmean_of_counts(group1)\tmean(group2)\tvariance(group2)\tstderr(group2)\tmean_of_counts(group1)\tp-value\n";
+
+ for(int i = 0; i < row; i++){
+ if (m->control_pressed) { out.close(); return 0; }
+
+ out << (i+1);
+ for(int j = 0; j < 9; j++){ out << '\t' << storage[i][j]; }
+ out << endl;
+ }
+
+ out << endl << endl;
+ out.close();
+
+ return 0;
+
+ }catch(exception& e) {
+ m->errorOut(e, "MothurMetastats", "runMetastats");
+ exit(1);
+ }
+}
+/***********************************************************/
+//Find the initial values for the matrix
+int MothurMetastats::start(vector<double>& Imatrix, int secondGroupingStart, vector<double>& initial, vector< vector<double> >& storage) {
+ try {
+
+ int a = row; a*=4;
+
+ double xbardiff = 0.0; double denom = 0.0;
+ vector<double> store; store.resize(a, 0.0);
+ vector<double> tool; tool.resize(a, 0.0);
+ vector< vector<double> > C1; C1.resize(row);
+ for (int i = 0; i < C1.size(); i++) { C1[i].resize(3, 0.0); }
+ vector< vector<double> > C2; C2.resize(row);
+ for (int i = 0; i < C2.size(); i++) { C2[i].resize(3, 0.0); }
+
+ meanvar(Imatrix, secondGroupingStart, store);
+
+ if (m->control_pressed) { return 0; }
+
+ //copy store into tool
+ tool = store;
+
+ for (int i = 0; i < row; i++){
+ C1[i][0]=tool[i]; //mean group 1
+ storage[i][0]=C1[i][0];
+ C1[i][1]=tool[i+row+row]; // var group 1
+ storage[i][1]=C1[i][1];
+ C1[i][2]=C1[i][1]/(secondGroupingStart-1);
+ storage[i][2]=sqrt(C1[i][2]);
+
+ C2[i][0]=tool[i+row]; // mean group 2
+ storage[i][4]=C2[i][0];
+ C2[i][1]=tool[i+row+row+row]; // var group 2
+ storage[i][5]=C2[i][1];
+ C2[i][2]=C2[i][1]/(column-secondGroupingStart+1);
+ storage[i][6]=sqrt(C2[i][2]);
+ }
+
+ if (m->control_pressed) { return 0; }
+
+ for (int i = 0; i < row; i++){
+ xbardiff = C1[i][0]-C2[i][0];
+ denom = sqrt(C1[i][2]+C2[i][2]);
+ initial[i]=fabs(xbardiff/denom);
+ }
+
+ return 0;
+
+ }catch(exception& e) {
+ m->errorOut(e, "MothurMetastats", "start");
+ exit(1);
+ }
+}
+/***********************************************************/
+int MothurMetastats::meanvar(vector<double>& pmatrix, int secondGroupingStart, vector<double>& store) {
+ try {
+ vector<double> temp; temp.resize(row, 0.0);
+ vector<double> temp2; temp2.resize(row, 0.0);
+ vector<double> var; var.resize(row, 0.0);
+ vector<double> var2; var2.resize(row, 0.0);
+
+ double a = secondGroupingStart-1;
+ double b = column - a;
+ int m = a * row;
+ int n = row * column;
+
+ for (int i = 0; i < m; i++) { temp[i%row] += pmatrix[i]; }
+ for (int i = 0; i < n; i++) { temp2[i%row]+= pmatrix[i]; }
+ for (int i = 0; i < row; i++) { temp2[i] -= temp[i]; }
+ for (int i = 0; i <= row-1;i++) {
+ store[i] = temp[i]/a;
+ store[i+row]=temp2[i]/b;
+ }
+
+ //That completes the mean calculations.
+
+ for (int i = 0; i < m; i++) { var[i%row] += pow((pmatrix[i]-store[i%row]),2); }
+ for (int i = m; i < n; i++) { var2[i%row]+= pow((pmatrix[i]-store[(i%row)+row]),2); }
+ for (int i = 0; i <= row-1; i++){
+ store[i+2*row]=var[i]/(a-1);
+ store[i+3*row]=var2[i]/(b-1);
+ }
+
+ // That completes var calculations.
+
+ return 0;
+
+ }catch(exception& e) {
+ m->errorOut(e, "MothurMetastats", "meanvar");
+ exit(1);
+ }
+}
+/***********************************************************/
+int MothurMetastats::testp(vector<double>& permuted_ttests, vector<double>& permuted, vector<double>& Imatrix, int secondGroupingStart, vector<double>& Tinitial, vector<double>& ps) {
+ try {
+
+ vector<double> Tvalues; Tvalues.resize(row, 0.0);
+ vector<double> counter; counter.resize(row, 0.0);
+ int a, b, n;
+
+ a = numPermutations;
+ b = row;
+ n = a*b;
+
+ for (int j = 1; j <= row; j++) {
+ if (m->control_pressed) { return 0; }
+ permute_matrix(Imatrix, permuted, secondGroupingStart, Tvalues, Tinitial, counter);
+ }
+
+ for(int j = 0; j < row; j++) {
+ if (m->control_pressed) { return 0; }
+ ps[j] = ((counter[j]+1)/(double)(a+1));
+ }
+
+ return 0;
+
+ }catch(exception& e) {
+ m->errorOut(e, "MothurMetastats", "testp");
+ exit(1);
+ }
+}
+/***********************************************************/
+int MothurMetastats::permute_matrix(vector<double>& Imatrix, vector<double>& permuted, int secondGroupingStart, vector<double>& trial_ts, vector<double>& Tinitial, vector<double>& counter1){
+ try {
+
+ vector<int> y; y.resize(column, 0);
+ for (int i = 1; i <= column; i++){ y[i-1] = i; }
+
+ permute_array(y);
+
+ int f = 0; int c = 0; int k = 0;
+ for (int i = 0; i < column; i++){
+
+ if (m->control_pressed) { return 0; }
+
+ f = y[i]; //column number
+ c = 1;
+ c *= (f-1);
+ c *= row;
+ if (f == 1){ c = 0; } // starting value position in the Imatrix
+
+ for(int j = 1; j <= row; j++){
+ permuted[k] = Imatrix[c];
+ c++; k++;
+ }
+ }
+
+ calc_twosample_ts(permuted, secondGroupingStart, trial_ts, Tinitial, counter1);
+
+ return 0;
+
+ }catch(exception& e) {
+ m->errorOut(e, "MothurMetastats", "permute_matrix");
+ exit(1);
+ }
+}
+/***********************************************************/
+int MothurMetastats::permute_array(vector<int>& array) {
+ try {
+ static int seeded = 0;
+
+ if (! seeded) {
+ seeded = 1;
+ srand(time(NULL));
+ }
+
+ for (int i = 0; i < array.size(); i++) {
+ if (m->control_pressed) { return 0; }
+
+ int selection = rand() % (array.size() - i);
+ int tmp = array[i + selection];
+ array[i + selection] = array[i];
+ array[i] = tmp;
+ }
+
+ return 0;
+
+ }catch(exception& e) {
+ m->errorOut(e, "MothurMetastats", "permute_array");
+ exit(1);
+ }
+}
+/***********************************************************/
+int MothurMetastats::calc_twosample_ts(vector<double>& Pmatrix, int secondGroupingStart, vector<double>& Ts, vector<double>& Tinitial, vector<double>& counter) {
+ try {
+ int a = row * 4;
+
+ vector< vector<double> > C1; C1.resize(row);
+ for (int i = 0; i < C1.size(); i++) { C1[i].resize(3, 0.0); }
+ vector< vector<double> > C2; C2.resize(row);
+ for (int i = 0; i < C2.size(); i++) { C2[i].resize(3, 0.0); }
+ vector<double> storage; storage.resize(row, 0.0);
+ vector<double> tool; tool.resize(row, 0.0);
+ double xbardiff = 0.0; double denom = 0.0;
+
+ meanvar(Pmatrix, secondGroupingStart, storage);
+
+ for(int i = 0;i <= (a-1); i++) {
+ if (m->control_pressed) { return 0; }
+ tool[i] = storage[i];
+ }
+
+ for (int i = 0; i < row; i++){
+ if (m->control_pressed) { return 0; }
+ C1[i][0]=tool[i];
+ C1[i][1]=tool[i+row+row];
+ C1[i][2]=C1[i][1]/(secondGroupingStart-1);
+
+ C2[i][0]=tool[i+row];
+ C2[i][1]=tool[i+row+row+row]; // var group 2
+ C2[i][2]=C2[i][1]/(column-secondGroupingStart+1);
+ }
+
+ for (int i = 0; i < row; i++){
+ if (m->control_pressed) { return 0; }
+ xbardiff = C1[i][0]-C2[i][0];
+ denom = sqrt(C1[i][2]+C2[i][2]);
+ Ts[i]=fabs(xbardiff/denom);
+ if (fabs(Ts[i])>(fabs(Tinitial[i])+.0000000000001)){ //13th place
+ counter[i]++;
+ }
+ }
+
+ return 0;
+
+ }catch(exception& e) {
+ m->errorOut(e, "MothurMetastats", "calc_twosample_ts");
+ exit(1);
+ }
+}
+/***********************************************************/
+
+
--- /dev/null
+#ifndef MOTHUR_METASTATS
+#define MOTHUR_METASTATS
+
+/*
+ * mothurmetastats.h
+ * Mothur
+ *
+ * Created by westcott on 7/6/11.
+ * Copyright 2011 Schloss Lab. All rights reserved.
+ *
+ */
+
+
+#include "mothurout.h"
+
+class MothurMetastats {
+
+ public:
+ MothurMetastats(double, int); //threshold, numPermutations
+ ~MothurMetastats();
+
+ int runMetastats(string, vector< vector<double> >&, int); //outputFileName, data, secondGroupingStart
+
+ private:
+ MothurOut* m;
+ int row, column, numPermutations;
+ double threshold;
+
+ int start(vector<double>&, int, vector<double>&, vector< vector<double> >&); //Find the initial values for the matrix
+ int meanvar(vector<double>&, int, vector<double>&);
+ int testp(vector<double>&, vector<double>&, vector<double>&, int, vector<double>&, vector<double>&);
+ int permute_matrix(vector<double>&, vector<double>&, int, vector<double>&, vector<double>&, vector<double>&);
+ int permute_array(vector<int>&);
+ int calc_twosample_ts(vector<double>&, int, vector<double>&, vector<double>&, vector<double>&);
+
+
+
+
+};
+
+ //void testp(double *permuted_ttests,int *B,double *permuted,double
+ // *Imatrix,int *nc,int *nr,int *g,double *Tinitial,double *ps);
+ //void permute_matrix(double *Imatrix,int *nc,int *nr,double
+ // *permuted,int *g,double *trial_ts,double *Tinitial,double
+ // *counter);
+ //void permute_array(int *array, int n);
+ //void calc_twosample_ts(double *Pmatrix,int *g,int *nc,int *nr,double
+ // *Ts,double *Tinitial,double *counter1);
+ //void meanvar(double *pmatrix,int *g,int *nr,int *nc,double *storage);
+ //void start(double *Imatrix,int *g,int *nr,int *nc,double *testing,
+ // double storage[][9]);
+
+ //int metastat_main (char*, int, int, double, int, double**, int);
+
+
+#endif
+
cerr << "Decompressing " << completeFileName << " via temporary named pipe " << tempName << "\n";
system(command.c_str());
cerr << "Done decompressing " << completeFileName << "\n";
- remove(tempName.c_str());
+ mothurRemove(tempName);
exit(EXIT_SUCCESS);
} else {
cerr << "waiting on child process " << fork_result << "\n";
cerr << "Decompressing " << completeFileName << " via temporary named pipe " << tempName << "\n";
system(command.c_str());
cerr << "Done decompressing " << completeFileName << "\n";
- remove(tempName.c_str());
+ mothurRemove(tempName);
exit(EXIT_SUCCESS);
} else {
cerr << "waiting on child process " << fork_result << "\n";
string command = "mv " + oldName + " " + newName;
system(command.c_str());
#else
- remove(newName.c_str());
+ m->mothurRemove(newName);
int renameOk = rename(oldName.c_str(), newName.c_str());
#endif
return 0;
output.close();
//remove temp files
- remove(tempDistFile.c_str());
- remove(tempOutfile.c_str());
+ mothurRemove(tempDistFile);
+ mothurRemove(tempOutfile);
#endif
return outfile;
exit(1);
}
}
+/***********************************************************************/
+void MothurOut::mothurRemove(string filename){
+ try {
+ filename = getFullPathName(filename);
+ remove(filename.c_str());
+ }
+ catch(exception& e) {
+ errorOut(e, "MothurOut", "mothurRemove");
+ exit(1);
+ }
+}
/**************************************************************************************************/
vector<vector<double> > MothurOut::binomial(int maxOrder){
map<string, int> readNames(string);
int readNames(string, map<string, string>&);
int readNames(string, vector<seqPriorityNode>&, map<string, string>&);
+ void mothurRemove(string);
//searchs and checks
bool checkReleaseVersion(ifstream&, string);
vector< vector<double> > thisConfig;
if (axesfile == "") { thisConfig = generateStartingConfiguration(names.size(), i); }
else { thisConfig = getConfiguration(axes, i); }
- if (m->control_pressed) { out.close(); out2.close(); for (int k = 0; k < outputNames.size(); k++) { remove(outputNames[k].c_str()); } return 0; }
+ if (m->control_pressed) { out.close(); out2.close(); for (int k = 0; k < outputNames.size(); k++) { m->mothurRemove(outputNames[k]); } return 0; }
//calc nmds for this dimension
double stress;
vector< vector<double> > endConfig = nmdsCalc(matrix, thisConfig, stress);
- if (m->control_pressed) { out.close(); out2.close(); for (int k = 0; k < outputNames.size(); k++) { remove(outputNames[k].c_str()); } return 0; }
+ if (m->control_pressed) { out.close(); out2.close(); for (int k = 0; k < outputNames.size(); k++) { m->mothurRemove(outputNames[k]); } return 0; }
//calc euclid distances for new config
vector< vector<double> > newEuclid = linearCalc.calculateEuclidianDistance(endConfig);
- if (m->control_pressed) { out.close(); out2.close(); for (int k = 0; k < outputNames.size(); k++) { remove(outputNames[k].c_str()); } return 0; }
+ if (m->control_pressed) { out.close(); out2.close(); for (int k = 0; k < outputNames.size(); k++) { m->mothurRemove(outputNames[k]); } return 0; }
//calc correlation between original distances and euclidean distances from this config
double rsquared = linearCalc.calcPearson(newEuclid, matrix);
rsquared *= rsquared;
- if (m->control_pressed) { out.close(); out2.close(); for (int k = 0; k < outputNames.size(); k++) { remove(outputNames[k].c_str()); } return 0; }
+ if (m->control_pressed) { out.close(); out2.close(); for (int k = 0; k < outputNames.size(); k++) { m->mothurRemove(outputNames[k]); } return 0; }
//output results
out << "Config" << (j+1) << '\t';
bestConfig = endConfig;
}
- if (m->control_pressed) { out.close(); out2.close(); for (int k = 0; k < outputNames.size(); k++) { remove(outputNames[k].c_str()); } return 0; }
+ if (m->control_pressed) { out.close(); out2.close(); for (int k = 0; k < outputNames.size(); k++) { m->mothurRemove(outputNames[k]); } return 0; }
}
}
outBest.close();
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
//as long as you are not at the end of the file or done wih the lines you want
while((lookup[0] != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
- if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; } m->Groups.clear(); out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; } m->Groups.clear(); out.close(); m->mothurRemove(outputFileName); return 0; }
if(allLines == 1 || labels.count(lookup[0]->getLabel()) == 1){
//prevent memory leak
for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; lookup[i] = NULL; }
- if (m->control_pressed) { outputTypes.clear(); m->Groups.clear(); out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { outputTypes.clear(); m->Groups.clear(); out.close(); m->mothurRemove(outputFileName); return 0; }
//get next line to process
lookup = input->getSharedRAbundVectors();
}
- if (m->control_pressed) { outputTypes.clear(); m->Groups.clear(); out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { outputTypes.clear(); m->Groups.clear(); out.close(); m->mothurRemove(outputFileName); return 0; }
//output error messages about any remaining user labels
set<string>::iterator it;
//as long as you are not at the end of the file or done wih the lines you want
while((lookupFloat[0] != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
- if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < lookupFloat.size(); i++) { delete lookupFloat[i]; } m->Groups.clear(); out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < lookupFloat.size(); i++) { delete lookupFloat[i]; } m->Groups.clear(); out.close(); m->mothurRemove(outputFileName); return 0; }
if(allLines == 1 || labels.count(lookupFloat[0]->getLabel()) == 1){
//prevent memory leak
for (int i = 0; i < lookupFloat.size(); i++) { delete lookupFloat[i]; lookupFloat[i] = NULL; }
- if (m->control_pressed) { outputTypes.clear(); m->Groups.clear(); out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { outputTypes.clear(); m->Groups.clear(); out.close(); m->mothurRemove(outputFileName); return 0; }
//get next line to process
lookupFloat = input->getSharedRAbundFloatVectors();
}
- if (m->control_pressed) { outputTypes.clear(); m->Groups.clear(); out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { outputTypes.clear(); m->Groups.clear(); out.close(); m->mothurRemove(outputFileName); return 0; }
//output error messages about any remaining user labels
set<string>::iterator it;
delete input;
out.close();
- if (m->control_pressed) { outputTypes.clear(); remove(outputFileName.c_str()); return 0;}
+ if (m->control_pressed) { outputTypes.clear(); m->mothurRemove(outputFileName); return 0;}
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
if (pickedGroups) { eliminateZeroOTUS(thisLookUp); }
if (method == "totalgroup") {
+
+ //save numSeqs since they will change as the data is normalized
+ vector<int> sizes;
+ for (int i = 0; i < thisLookUp.size(); i++) { sizes.push_back(thisLookUp[i]->getNumSeqs()); }
for (int j = 0; j < thisLookUp[0]->getNumBins(); j++) {
int abund = thisLookUp[i]->getAbundance(j);
- float relabund = abund / (float) thisLookUp[i]->getNumSeqs();
+ float relabund = abund / (float) sizes[i];
float newNorm = relabund * norm;
//round to nearest int
if (method == "totalgroup") {
+ //save numSeqs since they will change as the data is normalized
+ vector<float> sizes;
+ for (int i = 0; i < thisLookUp.size(); i++) { sizes.push_back(thisLookUp[i]->getNumSeqs()); }
+
for (int j = 0; j < thisLookUp[0]->getNumBins(); j++) {
for (int i = 0; i < thisLookUp.size(); i++) {
float abund = thisLookUp[i]->getAbundance(j);
- float relabund = abund / (float) thisLookUp[i]->getNumSeqs();
+ float relabund = abund / (float) sizes[i];
float newNorm = relabund * norm;
thisLookUp[i]->set(j, newNorm, thisLookUp[i]->getGroup());
//go through each bin in "big" otu and output the bins in "little" otu which created it
for (int i = 0; i < lists[1].getNumBins(); i++) {
- if (m->control_pressed) { outputTypes.clear(); out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { outputTypes.clear(); out.close(); m->mothurRemove(outputFileName); return 0; }
string names = lists[1].get(i);
out.close();
- if (m->control_pressed) { outputTypes.clear(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { outputTypes.clear(); m->mothurRemove(outputFileName); return 0; }
m->mothurOutEndLine();
m->mothurOut("Output File Name: "); m->mothurOutEndLine();
if (output == "lt") { //does the user want lower triangle phylip formatted file
outputFile = outputDir + m->getRootName(m->getSimpleName(fastaFileNames[s])) + "phylip.dist";
- remove(outputFile.c_str()); outputTypes["phylip"].push_back(outputFile);
+ m->mothurRemove(outputFile); outputTypes["phylip"].push_back(outputFile);
}else if (output == "column") { //user wants column format
outputFile = outputDir + m->getRootName(m->getSimpleName(fastaFileNames[s])) + "dist";
outputTypes["column"].push_back(outputFile);
- remove(outputFile.c_str());
+ m->mothurRemove(outputFile);
}else { //assume square
outputFile = outputDir + m->getRootName(m->getSimpleName(fastaFileNames[s])) + "square.dist";
- remove(outputFile.c_str());
+ m->mothurRemove(outputFile);
outputTypes["phylip"].push_back(outputFile);
}
driverMPI(start, end, outMPI, cutoff);
- if (m->control_pressed) { outputTypes.clear(); MPI_File_close(&outMPI); remove(outputFile.c_str()); delete distCalculator; return 0; }
+ if (m->control_pressed) { outputTypes.clear(); MPI_File_close(&outMPI); m->mothurRemove(outputFile); delete distCalculator; return 0; }
//wait on chidren
for(int i = 1; i < processors; i++) {
- if (m->control_pressed) { outputTypes.clear(); MPI_File_close(&outMPI); remove(outputFile.c_str()); delete distCalculator; return 0; }
+ if (m->control_pressed) { outputTypes.clear(); MPI_File_close(&outMPI); m->mothurRemove(outputFile); delete distCalculator; return 0; }
char buf[5];
MPI_Recv(buf, 5, MPI_CHAR, i, tag, MPI_COMM_WORLD, &status);
//do your part
driverMPI(start, end, outMPI, cutoff);
- if (m->control_pressed) { outputTypes.clear(); MPI_File_close(&outMPI); remove(outputFile.c_str()); delete distCalculator; return 0; }
+ if (m->control_pressed) { outputTypes.clear(); MPI_File_close(&outMPI); m->mothurRemove(outputFile); delete distCalculator; return 0; }
char buf[5];
strcpy(buf, "done");
if (output != "square"){ driverMPI(start, end, outputFile, mySize); }
else { driverMPI(start, end, outputFile, mySize, output); }
- if (m->control_pressed) { outputTypes.clear(); remove(outputFile.c_str()); delete distCalculator; return 0; }
+ if (m->control_pressed) { outputTypes.clear(); m->mothurRemove(outputFile); delete distCalculator; return 0; }
int amode=MPI_MODE_APPEND|MPI_MODE_WRONLY|MPI_MODE_CREATE; //
MPI_File outMPI;
for(int b = 1; b < processors; b++) {
unsigned long int fileSize;
- if (m->control_pressed) { outputTypes.clear(); MPI_File_close(&outMPI); remove(outputFile.c_str()); delete distCalculator; return 0; }
+ if (m->control_pressed) { outputTypes.clear(); MPI_File_close(&outMPI); m->mothurRemove(outputFile); delete distCalculator; return 0; }
MPI_Recv(&fileSize, 1, MPI_LONG, b, tag, MPI_COMM_WORLD, &status);
#endif
#endif
- if (m->control_pressed) { outputTypes.clear(); delete distCalculator; remove(outputFile.c_str()); return 0; }
+ if (m->control_pressed) { outputTypes.clear(); delete distCalculator; m->mothurRemove(outputFile); return 0; }
#ifdef USE_MPI
MPI_Comm_rank(MPI_COMM_WORLD, &pid);
m->mothurOut("It took " + toString(time(NULL) - startTime) + " to calculate the distances for " + toString(numSeqs) + " sequences."); m->mothurOutEndLine();
- if (m->control_pressed) { outputTypes.clear(); delete distCalculator; remove(outputFile.c_str()); return 0; }
+ if (m->control_pressed) { outputTypes.clear(); delete distCalculator; m->mothurRemove(outputFile); return 0; }
}
delete distCalculator;
//append and remove temp files
for (int i=0;i<processIDS.size();i++) {
m->appendFiles((filename + toString(processIDS[i]) + ".temp"), filename);
- remove((filename + toString(processIDS[i]) + ".temp").c_str());
+ m->mothurRemove((filename + toString(processIDS[i]) + ".temp"));
}
#endif
}
outFasta.close();
outQual.close();
- if (m->control_pressed) { outputTypes.clear(); remove(fastaFile.c_str()); remove(qualFile.c_str()); return 0; }
+ if (m->control_pressed) { outputTypes.clear(); m->mothurRemove(fastaFile); m->mothurRemove(qualFile); return 0; }
//set fasta file as new current fastafile
string current = "";
if (m->control_pressed) {
delete input; delete list; delete groupMap;
for (i=0; i<groupMap->namesOfGroups.size(); i++) { (*(filehandles[groupMap->namesOfGroups[i]])).close(); delete filehandles[groupMap->namesOfGroups[i]]; }
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear();
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear();
return 0;
}
if (m->control_pressed) {
delete input; delete list; delete groupMap;
for (i=0; i<groupMap->namesOfGroups.size(); i++) { (*(filehandles[groupMap->namesOfGroups[i]])).close(); delete filehandles[groupMap->namesOfGroups[i]]; }
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear();
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear();
return 0;
}
if (m->control_pressed) {
delete input; delete groupMap;
for (i=0; i<groupMap->namesOfGroups.size(); i++) { (*(filehandles[groupMap->namesOfGroups[i]])).close(); delete filehandles[groupMap->namesOfGroups[i]]; }
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear();
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear();
return 0;
}
if (m->control_pressed) {
delete input; delete groupMap;
for (i=0; i<groupMap->namesOfGroups.size(); i++) { (*(filehandles[groupMap->namesOfGroups[i]])).close(); delete filehandles[groupMap->namesOfGroups[i]]; }
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear();
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear();
return 0;
}
delete input;
if (m->control_pressed) {
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear();
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear();
return 0;
}
m->gobble(in);
}
in.close();
- remove(s.c_str());
+ m->mothurRemove(s);
}
return results;
if (m->control_pressed) {
delete tmap; for (int i = 0; i < T.size(); i++) { delete T[i]; }
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear();
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear();
m->Groups.clear();
return 0;
}
delete reading; delete pars; delete output;
delete tmap; for (int i = 0; i < T.size(); i++) { delete T[i]; }
if (randomtree == "") { outSum.close(); }
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear();
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear();
m->Groups.clear();
return 0;
}
delete reading; delete pars; delete output;
delete tmap; for (int i = 0; i < T.size(); i++) { delete T[i]; }
if (randomtree == "") { outSum.close(); }
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear();
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear();
m->Groups.clear();
return 0;
}
if (m->control_pressed) {
delete reading; delete pars; delete output; delete randT;
if (randomtree == "") { outSum.close(); }
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear();
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear();
delete tmap; for (int i = 0; i < T.size(); i++) { delete T[i]; }
m->Groups.clear();
return 0;
if (m->control_pressed) {
delete reading; delete pars; delete output; delete randT;
delete tmap;
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear();
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear();
m->Groups.clear();
return 0;
}
if (m->control_pressed) {
delete reading; delete pars; delete output; delete randT;
delete tmap;
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear();
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear();
m->Groups.clear();
return 0;
}
delete reading; delete pars; delete output;
delete tmap; for (int i = 0; i < T.size(); i++) { delete T[i]; }
if (randomtree == "") { outSum.close(); }
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear();
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear();
m->Groups.clear();
return 0;
}
delete pars; delete output;
delete tmap; for (int i = 0; i < T.size(); i++) { delete T[i]; }
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear(); return 0;}
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear(); return 0;}
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
//as long as you are not at the end of the file or done wih the lines you want
while((lookupFloat[0] != NULL) && (userLabels.size() != 0)) {
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } delete input; for (int i = 0; i < lookupFloat.size(); i++) { delete lookupFloat[i]; } lookupFloat.clear(); return 0; }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } delete input; for (int i = 0; i < lookupFloat.size(); i++) { delete lookupFloat[i]; } lookupFloat.clear(); return 0; }
if(labels.count(lookupFloat[0]->getLabel()) == 1){
processedLabels.insert(lookupFloat[0]->getLabel());
}
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } delete input; for (int i = 0; i < lookupFloat.size(); i++) { delete lookupFloat[i]; } lookupFloat.clear(); return 0; }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } delete input; for (int i = 0; i < lookupFloat.size(); i++) { delete lookupFloat[i]; } lookupFloat.clear(); return 0; }
//output error messages about any remaining user labels
set<string>::iterator it;
for (int i = 0; i < lookupFloat.size(); i++) { if (lookupFloat[i] != NULL) { delete lookupFloat[i]; } } lookupFloat.clear();
delete input;
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
vector< vector<double> > PCAEuclidDists = linearCalc.calculateEuclidianDistance(X, i); //G is the pca file
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
double corr = linearCalc.calcPearson(PCAEuclidDists, observedEuclideanDistance);
m->mothurOut("Rsq " + toString(i) + " axis: " + toString(corr * corr)); m->mothurOutEndLine();
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
}
}
output(fbase, names, G, d);
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
if (metric) {
vector< vector<double> > EuclidDists = linearCalc.calculateEuclidianDistance(G, i); //G is the pcoa file
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
double corr = linearCalc.calcPearson(EuclidDists, D); //G is the pcoa file, D is the users distance matrix
m->mothurOut("Rsq " + toString(i) + " axis: " + toString(corr * corr)); m->mothurOutEndLine();
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
}
}
if (m->control_pressed) {
delete tmap; for (int i = 0; i < trees.size(); i++) { delete trees[i]; }
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear();
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear();
m->Groups.clear();
return 0;
}
//for each of the users trees
for(int i = 0; i < trees.size(); i++) {
- if (m->control_pressed) { delete tmap; for (int j = 0; j < trees.size(); j++) { delete trees[j]; } for (int j = 0; j < outputNames.size(); j++) { remove(outputNames[j].c_str()); } return 0; }
+ if (m->control_pressed) { delete tmap; for (int j = 0; j < trees.size(); j++) { delete trees[j]; } for (int j = 0; j < outputNames.size(); j++) { m->mothurRemove(outputNames[j]); } return 0; }
ofstream outSum, outRare, outCollect;
string outSumFile = outputDir + m->getRootName(m->getSimpleName(treefile)) + toString(i+1) + ".phylodiv.summary";
}
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
}
in.close();
- remove(inTemp.c_str());
+ m->mothurRemove(inTemp);
}
#endif
try {
if (ignore) { assignRank(0); }
-
+
//print labels
out << "taxlevel\t rankID\t taxon\t daughterlevels\t total\t";
if (groupmap != NULL) {
for (int i = 0; i < groupmap->namesOfGroups.size(); i++) { out << tree[it->second].groupCount[groupmap->namesOfGroups[i]] << '\t'; }
}
out << endl;
+
}
print(it->second, out);
if (m->control_pressed) {
outRabund.close(); outSabund.close(); outList.close();
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); }
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); }
delete tree; return 0;
}
delete tree;
if (m->control_pressed) {
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); }
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); }
return 0;
}
}
in.close();
- remove(s.c_str());
+ m->mothurRemove(s);
}
#else
m->mothurOut("It took " + toString(time(NULL) - start) + " secs to cluster " + toString(numSeqs) + " sequences."); m->mothurOutEndLine();
- if (m->control_pressed) { remove(newFastaFile.c_str()); remove(newNamesFile.c_str()); return 0; }
+ if (m->control_pressed) { m->mothurRemove(newFastaFile); m->mothurRemove(newNamesFile); return 0; }
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
qFile >> seqName;
m->getline(qFile);
-
+ //cout << seqName << endl;
if (seqName == "") {
m->mothurOut("Error reading quality file, name blank at position, " + toString(qFile.tellg()));
m->mothurOutEndLine();
}
string qScoreString = m->getline(qFile);
+ //cout << qScoreString << endl;
while(qFile.peek() != '>' && qFile.peek() != EOF){
- qScoreString += ' ' + m->getline(qFile);
+ if (m->control_pressed) { break; }
+ string temp = m->getline(qFile);
+ //cout << temp << endl;
+ qScoreString += ' ' + temp;
}
-
+ //cout << "done reading " << endl;
istringstream qScoreStringStream(qScoreString);
int count = 0;
while(!qScoreStringStream.eof()){
if (m->control_pressed) { break; }
- qScoreStringStream >> score; m->gobble(qScoreStringStream);
-
+ string temp;
+ qScoreStringStream >> temp; m->gobble(qScoreStringStream);
+
+ //check temp to make sure its a number
+ if (!m->isContainingOnlyDigits(temp)) { m->mothurOut("[ERROR]: In sequence " + seqName + "'s quality scores, expected a number and got " + temp + ", setting score to 0."); m->mothurOutEndLine(); temp = "0"; }
+ convert(temp, score);
+
+ //cout << count << '\t' << score << endl;
qScores.push_back(score);
count++;
}
// qScores.pop_back();
seqLength = qScores.size();
- //cout << "seqlenght = " << seqLength << '\t' << count << endl;
+ //cout << "seqlength = " << seqLength << '\t' << count << endl;
}
catch(exception& e) {
for(int j=0;j<displays.size();j++){
string s = toString(processIDS[i]) + toString(j) + ".rarefact.temp";
displays[j]->inputTempFiles(s);
- remove(s.c_str());
+ m->mothurRemove(s);
}
}
string fileNameRoot = outputDir + m->getRootName(m->getSimpleName(inputFileNames[p]));
- if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } m->Groups.clear(); return 0; }
+ if (m->control_pressed) { outputTypes.clear(); for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } m->Groups.clear(); return 0; }
if (inputFileNames.size() > 1) {
m->mothurOutEndLine(); m->mothurOut("Processing group " + groups[p]); m->mothurOutEndLine(); m->mothurOutEndLine();
set<string> processedLabels;
set<string> userLabels = labels;
- if (m->control_pressed) { for(int i=0;i<rDisplays.size();i++){ delete rDisplays[i]; } delete input; delete order; for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { for(int i=0;i<rDisplays.size();i++){ delete rDisplays[i]; } delete input; delete order; for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
//as long as you are not at the end of the file or done wih the lines you want
while((order != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
- if (m->control_pressed) { for(int i=0;i<rDisplays.size();i++){ delete rDisplays[i]; } delete input; delete order; for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { for(int i=0;i<rDisplays.size();i++){ delete rDisplays[i]; } delete input; delete order; for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
if(allLines == 1 || labels.count(order->getLabel()) == 1){
order = (input->getOrderVector());
}
- if (m->control_pressed) { for(int i=0;i<rDisplays.size();i++){ delete rDisplays[i]; } delete input; for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { for(int i=0;i<rDisplays.size();i++){ delete rDisplays[i]; } delete input; for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
//output error messages about any remaining user labels
set<string>::iterator it;
}
}
- if (m->control_pressed) { for(int i=0;i<rDisplays.size();i++){ delete rDisplays[i]; } delete input; for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { for(int i=0;i<rDisplays.size();i++){ delete rDisplays[i]; } delete input; for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
//run last label if you need to
if (needToRun == true) {
}
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
//clears file before we start to write to it below
for (int i=0; i<lookup.size(); i++) {
- remove((sharedFileRoot + lookup[i]->getGroup() + ".rabund").c_str());
+ m->mothurRemove((sharedFileRoot + lookup[i]->getGroup() + ".rabund"));
filenames.push_back((sharedFileRoot + lookup[i]->getGroup() + ".rabund"));
}
m->Groups.clear();
delete input;
for(int i=0;i<rDisplays.size();i++){ delete rDisplays[i]; }
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); }
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); }
for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; }
return 0;
}
m->Groups.clear();
delete input;
for(int i=0;i<rDisplays.size();i++){ delete rDisplays[i]; }
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); }
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); }
for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; }
return 0;
}
m->Groups.clear();
delete input;
for(int i=0;i<rDisplays.size();i++){ delete rDisplays[i]; }
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); }
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); }
return 0;
}
m->Groups.clear();
delete input;
for(int i=0;i<rDisplays.size();i++){ delete rDisplays[i]; }
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); }
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); }
return 0;
}
m->Groups.clear();
delete input;
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
if (m->control_pressed) {
fileHandle.close();
if (!hclusterWanted) { delete matrix; }
- else { outOverlap.close(); remove(overlapFile.c_str()); outDist.close(); remove(distFile.c_str()); }
+ else { outOverlap.close(); m->mothurRemove(overlapFile); outDist.close(); m->mothurRemove(distFile); }
return 0;
}
if (m->control_pressed) {
fileHandle.close();
if (!hclusterWanted) { delete matrix; }
- else { outOverlap.close(); remove(overlapFile.c_str()); outDist.close(); remove(distFile.c_str()); }
+ else { outOverlap.close(); m->mothurRemove(overlapFile); outDist.close(); m->mothurRemove(distFile); }
delete reading;
return 0;
}
if (m->control_pressed) {
fileHandle.close();
if (!hclusterWanted) { delete matrix; }
- else { outOverlap.close(); remove(overlapFile.c_str()); outDist.close(); remove(distFile.c_str()); }
+ else { outOverlap.close(); m->mothurRemove(overlapFile); outDist.close(); m->mothurRemove(distFile); }
delete reading;
return 0;
}
if (m->control_pressed) {
fileHandle.close();
if (!hclusterWanted) { delete matrix; }
- else { remove(overlapFile.c_str()); remove(distFile.c_str()); }
+ else { m->mothurRemove(overlapFile); m->mothurRemove(distFile); }
delete reading;
return 0;
}
for(int j=0;j<i;j++){
- if (m->control_pressed) { in.close(); out.close(); remove(tempFile.c_str()); return 0; }
+ if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(tempFile); return 0; }
in >> distance;
for(int j=0;j<i;j++){
- if (m->control_pressed) { in.close(); out.close(); remove(tempFile.c_str()); return 0; }
+ if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(tempFile); return 0; }
in >> distance;
if(nameMap == NULL){
list->set(i, name);
for(int j=0;j<nseqs;j++){
- if (m->control_pressed) { in.close(); out.close(); remove(tempFile.c_str()); return 0; }
+ if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(tempFile); return 0; }
in >> distance;
if(nameMap->count(name)==0){ m->mothurOut("Error: Sequence '" + name + "' was not found in the names file, please correct"); m->mothurOutEndLine(); }
for(int j=0;j<nseqs;j++){
- if (m->control_pressed) { in.close(); out.close(); remove(tempFile.c_str()); return 0; }
+ if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(tempFile); return 0; }
in >> distance;
float dist;
while (in2) {
- if (m->control_pressed) { in2.close(); out2.close(); remove(tempFile.c_str()); remove(outputFile.c_str()); return 0; }
+ if (m->control_pressed) { in2.close(); out2.close(); m->mothurRemove(tempFile); m->mothurRemove(outputFile); return 0; }
in2 >> first >> second >> dist;
out2 << rowToName[first] << '\t' << rowToName[second] << '\t' << dist << endl;
in2.close();
out2.close();
- remove(tempFile.c_str());
+ m->mothurRemove(tempFile);
distFile = outputFile;
- if (m->control_pressed) { remove(outputFile.c_str()); }
+ if (m->control_pressed) { m->mothurRemove(outputFile); }
return 0;
}
m->openOutputFile(newGroupFile, outGroups);
for (int i = 0; i < matrix->getNumSeqs(); i++) {
- if (m->control_pressed) { delete groupMap; delete matrix; outGroups.close(); remove(newGroupFile.c_str()); return 0; }
+ if (m->control_pressed) { delete groupMap; delete matrix; outGroups.close(); m->mothurRemove(newGroupFile); return 0; }
Names temp = matrix->getRowInfo(i);
outGroups << temp.seqName << '\t' << temp.groupName << endl;
groupMap = new GroupMap(groupfile);
groupMap->readMap();
- if (m->control_pressed) { delete groupMap; delete matrix; remove(newGroupFile.c_str()); return 0; }
+ if (m->control_pressed) { delete groupMap; delete matrix; m->mothurRemove(newGroupFile); return 0; }
globaldata->gGroupmap = groupMap;
}
if (listfile != "") { readList(); }
if (taxfile != "") { readTax(); }
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
m->mothurOut("Removed " + toString(names.size()) + " sequences. From the groups: "); m->mothurOutEndLine();
for (int i = 0; i < Groups.size(); i++) { m->mothurOut(Groups[i]); m->mothurOut("\t" + toString(groupMap->getNumSeqs(Groups[i]))); m->mothurOutEndLine(); }
bool wroteSomething = false;
while(!in.eof()){
- if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outputFileName); return 0; }
Sequence currSeq(in);
name = currSeq.getName();
//for each bin
for (int i = 0; i < list.getNumBins(); i++) {
- if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outputFileName); return 0; }
//parse out names that are in accnos file
string binnames = list.get(i);
bool wroteSomething = false;
while(!in.eof()){
- if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outputFileName); return 0; }
in >> firstCol; m->gobble(in);
in >> secondCol;
bool wroteSomething = false;
while(!in.eof()){
- if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outputFileName); return 0; }
in >> name; //read from first column
in >> group; //read from second column
bool wroteSomething = false;
while(!in.eof()){
- if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outputFileName); return 0; }
in >> name; //read from first column
in >> tax; //read from second column
if (listfile != "") { readList(); }
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
if (outputNames.size() != 0) {
m->mothurOutEndLine();
bool wroteSomething = false;
while(!in.eof()){
- if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outputFileName); return 0; }
Sequence currSeq(in);
name = currSeq.getName();
//for each bin
for (int i = 0; i < list.getNumBins(); i++) {
- if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outputFileName); return 0; }
//parse out names that are in accnos file
string binnames = list.get(i);
bool wroteSomething = false;
while(!in.eof()){
- if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outputFileName); return 0; }
in >> firstCol;
in >> secondCol;
bool wroteSomething = false;
while(!in.eof()){
- if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outputFileName); return 0; }
in >> name; //read from first column
in >> group; //read from second column
while(!in.eof()){
- if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outputFileName); return 0; }
in >> name; //read from first column
in >> tax; //read from second column
out << endl;
while(!in.eof()){
- if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outputFileName); return 0; }
in >> name; //read from first column
//read through the list file keeping any otus that contain any sequence from the groups selected
readListGroup();
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
if (outputNames.size() != 0) {
m->mothurOutEndLine();
//as long as you are not at the end of the file or done wih the lines you want
while((list != NULL) && (userLabels.size() != 0)) {
- if (m->control_pressed) { delete list; delete input; out.close(); outGroup.close(); remove(outputFileName.c_str()); remove(outputGroupFileName.c_str());return 0; }
+ if (m->control_pressed) { delete list; delete input; out.close(); outGroup.close(); m->mothurRemove(outputFileName); m->mothurRemove(outputGroupFileName);return 0; }
if(labels.count(list->getLabel()) == 1){
processList(list, groupMap, out, outGroup, wroteSomething);
}
- if (m->control_pressed) { if (list != NULL) { delete list; } delete input; out.close(); outGroup.close(); remove(outputFileName.c_str()); remove(outputGroupFileName.c_str()); return 0; }
+ if (m->control_pressed) { if (list != NULL) { delete list; } delete input; out.close(); outGroup.close(); m->mothurRemove(outputFileName); m->mothurRemove(outputGroupFileName); return 0; }
//output error messages about any remaining user labels
set<string>::iterator it;
if (listfile != "") { processList(); }
if (sharedfile != "") { processShared(); }
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
if (outputNames.size() != 0) {
m->mothurOutEndLine();
//for each bin
for (int i = 0; i < list->getNumBins(); i++) {
- if (m->control_pressed) { if (groupfile != "") { delete groupMap; outGroup.close(); remove(outputGroupFileName.c_str()); } out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { if (groupfile != "") { delete groupMap; outGroup.close(); m->mothurRemove(outputGroupFileName); } out.close(); m->mothurRemove(outputFileName); return 0; }
//parse out names that are in accnos file
string binnames = list->get(i);
if (taxfile != "") { readTax(); }
if (qualfile != "") { readQual(); }
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
-
- m->mothurOut("Removed " + toString(names.size()) + " sequences."); m->mothurOutEndLine();
-
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
+
if (outputNames.size() != 0) {
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
string name;
bool wroteSomething = false;
+ int removedCount = 0;
while(!in.eof()){
- if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outputFileName); return 0; }
Sequence currSeq(in);
name = currSeq.getName();
wroteSomething = true;
currSeq.printSequence(out);
- }
+ }else { removedCount++; }
}
m->gobble(in);
}
if (wroteSomething == false) { m->mothurOut("Your file contains only sequences from the .accnos file."); m->mothurOutEndLine(); }
outputTypes["fasta"].push_back(outputFileName); outputNames.push_back(outputFileName);
+ m->mothurOut("Removed " + toString(removedCount) + " sequences from your fasta file."); m->mothurOutEndLine();
+
return 0;
}
string name;
bool wroteSomething = false;
+ int removedCount = 0;
while(!in.eof()){
wroteSomething = true;
out << name << endl << scores;
- }
+ }else { removedCount++; }
m->gobble(in);
}
if (wroteSomething == false) { m->mothurOut("Your file contains only sequences from the .accnos file."); m->mothurOutEndLine(); }
outputNames.push_back(outputFileName); outputTypes["qfile"].push_back(outputFileName);
+ m->mothurOut("Removed " + toString(removedCount) + " sequences from your quality file."); m->mothurOutEndLine();
+
return 0;
}
m->openInputFile(listfile, in);
bool wroteSomething = false;
+ int removedCount = 0;
while(!in.eof()){
//read in list vector
//for each bin
for (int i = 0; i < list.getNumBins(); i++) {
- if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outputFileName); return 0; }
//parse out names that are in accnos file
string binnames = list.get(i);
//if that name is in the .accnos file, add it
if (names.count(name) == 0) { newNames += name + ","; }
+ else { removedCount++; }
}
//get last name
if (names.count(binnames) == 0) { newNames += binnames + ","; }
+ else { removedCount++; }
//if there are names in this bin add to new list
if (newNames != "") {
if (wroteSomething == false) { m->mothurOut("Your file contains only sequences from the .accnos file."); m->mothurOutEndLine(); }
outputTypes["list"].push_back(outputFileName); outputNames.push_back(outputFileName);
-
+
+ m->mothurOut("Removed " + toString(removedCount) + " sequences from your list file."); m->mothurOutEndLine();
+
return 0;
}
string name, firstCol, secondCol;
bool wroteSomething = false;
-
+ int removedCount = 0;
while(!in.eof()){
- if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outputFileName); return 0; }
in >> firstCol; m->gobble(in);
in >> secondCol;
if ((dups) && (validSecond.size() != parsedNames.size())) { //if dups is true and we want to get rid of anyone, get rid of everyone
for (int i = 0; i < parsedNames.size(); i++) { names.insert(parsedNames[i]); }
+ removedCount += parsedNames.size();
}else {
+ removedCount += parsedNames.size()-validSecond.size();
//if the name in the first column is in the set then print it and any other names in second column also in set
if (names.count(firstCol) == 0) {
if (wroteSomething == false) { m->mothurOut("Your file contains only sequences from the .accnos file."); m->mothurOutEndLine(); }
outputTypes["name"].push_back(outputFileName); outputNames.push_back(outputFileName);
+ m->mothurOut("Removed " + toString(removedCount) + " sequences from your name file."); m->mothurOutEndLine();
+
return 0;
}
catch(exception& e) {
string name, group;
bool wroteSomething = false;
+ int removedCount = 0;
while(!in.eof()){
- if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outputFileName); return 0; }
in >> name; //read from first column
in >> group; //read from second column
if (names.count(name) == 0) {
wroteSomething = true;
out << name << '\t' << group << endl;
- }
+ }else { removedCount++; }
m->gobble(in);
}
if (wroteSomething == false) { m->mothurOut("Your file contains only sequences from the .accnos file."); m->mothurOutEndLine(); }
outputTypes["group"].push_back(outputFileName); outputNames.push_back(outputFileName);
+ m->mothurOut("Removed " + toString(removedCount) + " sequences from your group file."); m->mothurOutEndLine();
+
+
return 0;
}
catch(exception& e) {
string name, tax;
bool wroteSomething = false;
+ int removedCount = 0;
while(!in.eof()){
- if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outputFileName); return 0; }
in >> name; //read from first column
in >> tax; //read from second column
if (names.count(name) == 0) {
wroteSomething = true;
out << name << '\t' << tax << endl;
- }
+ }else { removedCount++; }
m->gobble(in);
}
if (wroteSomething == false) { m->mothurOut("Your file contains only sequences from the .accnos file."); m->mothurOutEndLine(); }
outputTypes["taxonomy"].push_back(outputFileName); outputNames.push_back(outputFileName);
+ m->mothurOut("Removed " + toString(removedCount) + " sequences from your taxonomy file."); m->mothurOutEndLine();
+
return 0;
}
catch(exception& e) {
string name, junk;
bool wroteSomething = false;
+ int removedCount = 0;
//read column headers
for (int i = 0; i < 16; i++) {
out << endl;
while(!in.eof()){
- if (m->control_pressed) { in.close(); out.close(); remove(outputFileName.c_str()); return 0; }
+ if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outputFileName); return 0; }
in >> name; //read from first column
out << endl;
}else {//still read just don't do anything with it
+ removedCount++;
//read rest
for (int i = 0; i < 15; i++) {
if (wroteSomething == false) { m->mothurOut("Your file contains only sequences from the .accnos file."); m->mothurOutEndLine(); }
outputTypes["alignreport"].push_back(outputFileName); outputNames.push_back(outputFileName);
+ m->mothurOut("Removed " + toString(removedCount) + " sequences from your alignreport file."); m->mothurOutEndLine();
+
+
return 0;
}
m->openOutputFile(fastaReverseFileName, outFASTA);
while(!inFASTA.eof()){
- if (m->control_pressed) { inFASTA.close(); outFASTA.close(); remove(fastaReverseFileName.c_str()); return 0; }
+ if (m->control_pressed) { inFASTA.close(); outFASTA.close(); m->mothurRemove(fastaReverseFileName); return 0; }
Sequence currSeq(inFASTA); m->gobble(inFASTA);
if (currSeq.getName() != "") {
m->openOutputFile(qualReverseFileName, outQual);
while(!inQual.eof()){
- if (m->control_pressed) { inQual.close(); outQual.close(); remove(qualReverseFileName.c_str()); return 0; }
+ if (m->control_pressed) { inQual.close(); outQual.close(); m->mothurRemove(qualReverseFileName); return 0; }
currQual = QualityScores(inQual); m->gobble(inQual);
currQual.flipQScores();
currQual.printQScores(outQual);
outputNames.push_back(qualReverseFileName); outputTypes["qfile"].push_back(qualReverseFileName);
}
- if (m->control_pressed) { remove(qualReverseFileName.c_str()); remove(fastaReverseFileName.c_str()); return 0; }
+ if (m->control_pressed) { m->mothurRemove(qualReverseFileName); m->mothurRemove(fastaReverseFileName); return 0; }
//set fasta file as new current fastafile
string current = "";
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);
//append alignment and report files
for(int i=1;i<processors;i++){
m->appendFiles((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;
#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
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 (m->control_pressed) { remove(goodSeqFile.c_str()); return 0; }
+ if (m->control_pressed) { m->mothurRemove(goodSeqFile); return 0; }
#ifdef USE_MPI
}
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);
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;
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;
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);
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) {
inputGroups.close();
goodGroupOut.close();
- if (m->control_pressed) { remove(goodGroupFile.c_str()); }
+ if (m->control_pressed) { m->mothurRemove(goodGroupFile); }
return 0;
}
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);
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) {
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;
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 = "";
}
}
- if (m->control_pressed) { remove(goodQualFile.c_str()); return 0; }
+ if (m->control_pressed) { m->mothurRemove(goodQualFile); return 0; }
return 0;
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;
int count = 0;
while(!in.eof()){
- if (m->control_pressed) { in.close(); out.close(); remove(outfile.c_str()); return 0; }
+ if (m->control_pressed) { in.close(); out.close(); m->mothurRemove(outfile); return 0; }
Sequence seq(in); m->gobble(in);
if (seq.getName() != "") {
in.close();
out.close();
- if (m->control_pressed) { remove(outfile.c_str()); return 0; }
+ if (m->control_pressed) { m->mothurRemove(outfile); return 0; }
sort(pound.begin(), pound.end());
sort(dash.begin(), dash.end());
int ptile97_5 = int(size * 0.975);
int ptile100 = size - 1;
- if (m->control_pressed) { remove(outfile.c_str()); return 0; }
+ if (m->control_pressed) { m->mothurRemove(outfile); return 0; }
m->mothurOutEndLine();
m->mothurOut("\t\tPound\tDash\tPlus\tEqual\tLoop\tTilde\tTotal"); m->mothurOutEndLine();
printErrorFRFile(errorForward, errorReverse);
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
string errorCountFileName = queryFileName.substr(0,queryFileName.find_last_of('.')) + ".error.count";
ofstream errorCountFile;
}
errorCountFile.close();
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
printSubMatrix();
m->mothurOut("Appending files from process " + toString(processIDS[i])); m->mothurOutEndLine();
m->appendFiles((summaryFileName + toString(processIDS[i]) + ".temp"), summaryFileName);
- remove((summaryFileName + toString(processIDS[i]) + ".temp").c_str());
+ m->mothurRemove((summaryFileName + toString(processIDS[i]) + ".temp"));
m->appendFiles((errorOutputFileName + toString(processIDS[i]) + ".temp"), errorOutputFileName);
- remove((errorOutputFileName + toString(processIDS[i]) + ".temp").c_str());
+ m->mothurRemove((errorOutputFileName + toString(processIDS[i]) + ".temp"));
m->appendFiles((chimeraOutputFileName + toString(processIDS[i]) + ".temp"), chimeraOutputFileName);
- remove((chimeraOutputFileName + toString(processIDS[i]) + ".temp").c_str());
+ m->mothurRemove((chimeraOutputFileName + toString(processIDS[i]) + ".temp"));
ifstream in;
string tempFile = filename + toString(processIDS[i]) + ".info.temp";
}
m->gobble(in);
- in.close(); remove(tempFile.c_str());
+ in.close(); m->mothurRemove(tempFile);
}
#endif
//append files
for(int i=1;i<processors;i++){
m->appendFiles((summaryFile + toString(processIDS[i]) + ".temp"), summaryFile);
- remove((summaryFile + toString(processIDS[i]) + ".temp").c_str());
+ m->mothurRemove((summaryFile + toString(processIDS[i]) + ".temp"));
}
}
if (startPosition[0] == -1) { startPosition[0] = 0; }
if (endPosition[0] == -1) { endPosition[0] = 0; }
- if (m->control_pressed) { remove(summaryFile.c_str()); return 0; }
+ if (m->control_pressed) { m->mothurRemove(summaryFile); return 0; }
m->mothurOutEndLine();
m->mothurOut("\t\tStart\tEnd\tNBases\tAmbigs\tPolymer"); m->mothurOutEndLine();
if (namefile == "") { m->mothurOut("# of Seqs:\t" + toString(numSeqs)); m->mothurOutEndLine(); }
else { m->mothurOut("# of unique seqs:\t" + toString(numSeqs)); m->mothurOutEndLine(); m->mothurOut("total # of seqs:\t" + toString(startPosition.size())); m->mothurOutEndLine(); }
- if (m->control_pressed) { remove(summaryFile.c_str()); return 0; }
+ if (m->control_pressed) { m->mothurRemove(summaryFile); return 0; }
m->mothurOutEndLine();
m->mothurOut("Output File Name: "); m->mothurOutEndLine();
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;
m->mothurOut(output + " directory does not exist or is not writable."); m->mothurOutEndLine();
}else{
out.close();
- remove(outTemp.c_str());
+ m->mothurRemove(outTemp);
m->mothurOut("outputDir=" + output); m->mothurOutEndLine();
commandFactory->setOutputDirectory(output);
}
m->mothurOut(input + " directory does not exist or is not writable."); m->mothurOutEndLine();
}else{
in.close();
- remove(inTemp.c_str());
+ m->mothurRemove(inTemp);
m->mothurOut("inputDir=" + input); m->mothurOutEndLine();
commandFactory->setInputDirectory(input);
}
for (int s = 0; s < filenames.size(); s++) {
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
int start = time(NULL);
if (sfftxtFilename != "") { parseSffTxt(); }
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
//set fasta file as new current fastafile
string current = "";
//clears file before we start to write to it below
for (int i=0; i<Groups.size(); i++) {
- remove((fileroot + Groups[i] + ".rabund").c_str());
+ m->mothurRemove((fileroot + Groups[i] + ".rabund"));
outputNames.push_back((fileroot + Groups[i] + ".rabund"));
outputTypes["rabund"].push_back((fileroot + Groups[i] + ".rabund"));
}
if (m->control_pressed) {
delete input; delete SharedList; delete groupMap;
for (it3 = filehandles.begin(); it3 != filehandles.end(); it3++) { delete it3->second; }
- out.close(); remove(filename.c_str());
- for (int i=0; i<Groups.size(); i++) { remove((fileroot + Groups[i] + ".rabund").c_str()); }
+ out.close(); m->mothurRemove(filename);
+ for (int i=0; i<Groups.size(); i++) { m->mothurRemove((fileroot + Groups[i] + ".rabund")); }
return 0;
}
m->mothurOut("Your group file contains " + toString(groupMap->getNumSeqs()) + " sequences and list file contains " + toString(SharedList->getNumSeqs()) + " sequences. Please correct."); m->mothurOutEndLine();
out.close();
- remove(filename.c_str()); //remove blank shared file you made
+ m->mothurRemove(filename); //remove blank shared file you made
createMisMatchFile();
if (m->control_pressed) {
delete input; delete SharedList; delete groupMap;
for (it3 = filehandles.begin(); it3 != filehandles.end(); it3++) { delete it3->second; }
- out.close(); remove(filename.c_str());
- for (int i=0; i<Groups.size(); i++) { remove((fileroot + Groups[i] + ".rabund").c_str()); }
+ out.close(); m->mothurRemove(filename);
+ for (int i=0; i<Groups.size(); i++) { m->mothurRemove((fileroot + Groups[i] + ".rabund")); }
return 0;
}
delete input; delete SharedList; delete groupMap;
for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; }
for (it3 = filehandles.begin(); it3 != filehandles.end(); it3++) { delete it3->second; }
- out.close(); remove(filename.c_str());
- for (int i=0; i<Groups.size(); i++) { remove((fileroot + Groups[i] + ".rabund").c_str()); }
+ out.close(); m->mothurRemove(filename);
+ for (int i=0; i<Groups.size(); i++) { m->mothurRemove((fileroot + Groups[i] + ".rabund")); }
return 0;
}
delete input; delete SharedList; delete groupMap;
for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; }
for (it3 = filehandles.begin(); it3 != filehandles.end(); it3++) { delete it3->second; }
- out.close(); remove(filename.c_str());
- for (int i=0; i<Groups.size(); i++) { remove((fileroot + Groups[i] + ".rabund").c_str()); }
+ out.close(); m->mothurRemove(filename);
+ for (int i=0; i<Groups.size(); i++) { m->mothurRemove((fileroot + Groups[i] + ".rabund")); }
return 0;
}
if (m->control_pressed) {
delete input; delete groupMap;
for (it3 = filehandles.begin(); it3 != filehandles.end(); it3++) { delete it3->second; }
- out.close(); remove(filename.c_str());
- for (int i=0; i<Groups.size(); i++) { remove((fileroot + Groups[i] + ".rabund").c_str()); }
+ out.close(); m->mothurRemove(filename);
+ for (int i=0; i<Groups.size(); i++) { m->mothurRemove((fileroot + Groups[i] + ".rabund")); }
return 0;
}
delete input; delete groupMap;
if (m->control_pressed) {
- remove(filename.c_str());
- for (int i=0; i<Groups.size(); i++) { remove((fileroot + Groups[i] + ".rabund").c_str()); }
+ m->mothurRemove(filename);
+ for (int i=0; i<Groups.size(); i++) { m->mothurRemove((fileroot + Groups[i] + ".rabund")); }
return 0;
}
//go through list and if group returns "not found" output it
for (int i = 0; i < SharedList->getNumBins(); i++) {
- if (m->control_pressed) { outMisMatch.close(); remove(outputMisMatchName.c_str()); return 0; }
+ if (m->control_pressed) { outMisMatch.close(); m->mothurRemove(outputMisMatchName); return 0; }
string names = SharedList->get(i);
//loop through names in seqNames and if they aren't in namesIn list output them
for (int i = 0; i < seqNames.size(); i++) {
- if (m->control_pressed) { outMisMatch.close(); remove(outputMisMatchName.c_str()); return 0; }
+ if (m->control_pressed) { outMisMatch.close(); m->mothurRemove(outputMisMatchName); return 0; }
itMatch = namesInList.find(seqNames[i]);
MPI_Recv(&done, 1, MPI_INT, i, tag, MPI_COMM_WORLD, &status);
m->appendFiles((distFileName + ".temp." + toString(i)), distFileName);
- remove((distFileName + ".temp." + toString(i)).c_str());
+ m->mothurRemove((distFileName + ".temp." + toString(i)));
}
string namesFileName = createNamesFile();
getOTUData(listFileName);
- remove(distFileName.c_str());
- remove(namesFileName.c_str());
- remove(listFileName.c_str());
+ m->mothurRemove(distFileName);
+ m->mothurRemove(namesFileName);
+ m->mothurRemove(listFileName);
initPyroCluster();
string listFileName = cluster(distFileName, namesFileName);
getOTUData(listFileName);
- remove(distFileName.c_str());
- remove(namesFileName.c_str());
- remove(listFileName.c_str());
+ m->mothurRemove(distFileName);
+ m->mothurRemove(namesFileName);
+ m->mothurRemove(listFileName);
initPyroCluster();
//append and remove temp files
for (int i=0;i<processIDs.size();i++) {
m->appendFiles((fDistFileName + toString(processIDs[i]) + ".temp"), fDistFileName);
- remove((fDistFileName + toString(processIDs[i]) + ".temp").c_str());
+ m->mothurRemove((fDistFileName + toString(processIDs[i]) + ".temp"));
}
}
if (namefile != "") { readNamesFile(); }
else { createNameMap(list); }
- if (m->control_pressed) { delete input; delete list; for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { delete input; delete list; for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
while((list != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
- if (m->control_pressed) { delete input; delete list; for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { delete input; delete list; for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
if(allLines == 1 || labels.count(list->getLabel()) == 1){
list = input->getListVector(); //get new list vector to process
}
- if (m->control_pressed) { delete input; for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { delete input; for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
//output error messages about any remaining user labels
set<string>::iterator it;
}
- if (m->control_pressed) { delete input; for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { delete input; for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
//run last label if you need to
if (needToRun == true) {
delete input;
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
}else { //you are using the namefile to determine abundance
if (outputDir == "") { outputDir = m->hasPath(namefile); }
delete groupMap;
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
string current = "";
itTypes = outputTypes.find("fasta");
//remove blank files
for (int i = 0; i < outputNames.size(); i++) {
if (m->isBlank(outputNames[i])) {
- remove(outputNames[i].c_str());
+ m->mothurRemove(outputNames[i]);
}else { newOutputNames.push_back(outputNames[i]); }
}
outputNames = newOutputNames;
set<string> names;
for (int i = 0; i < numGroups; i++) { //remove old temp files, just in case
- remove((fastafile + "." + toString(i) + ".temp").c_str());
+ m->mothurRemove((fastafile + "." + toString(i) + ".temp"));
}
ifstream in;
command->execute();
delete command;
- remove((fastafile + "." + toString(i) + ".temp").c_str());
+ m->mothurRemove((fastafile + "." + toString(i) + ".temp"));
//remove old names files just in case
- remove((namefile + "." + toString(i) + ".temp").c_str());
+ m->mothurRemove((namefile + "." + toString(i) + ".temp"));
}
singleton = namefile + ".extra.temp";
remainingNames << name << '\t' << nameList << endl;
}
in.close();
- remove(tempNameFile.c_str());
+ m->mothurRemove(tempNameFile);
}
}
fileHandle.close();
remainingNames.close();
if (!wroteExtra) {
- remove(singleton.c_str());
+ m->mothurRemove(singleton);
singleton = "none";
}
- if (m->control_pressed) { for (int i = 0; i < dists.size(); i++) { remove((dists[i].begin()->first).c_str()); remove((dists[i].begin()->second).c_str()); } dists.clear(); }
+ if (m->control_pressed) { for (int i = 0; i < dists.size(); i++) { m->mothurRemove((dists[i].begin()->first)); m->mothurRemove((dists[i].begin()->second)); } dists.clear(); }
return 0;
}
ofstream outFile;
for (int i = 0; i < numGroups; i++) { //remove old temp files, just in case
- remove((distFile + "." + toString(i) + ".temp").c_str());
+ m->mothurRemove((distFile + "." + toString(i) + ".temp"));
}
//for buffering the io to improve speed
string seqA, seqB;
float dist;
- if (m->control_pressed) { dFile.close(); for (int i = 0; i < numGroups; i++) { remove((distFile + "." + toString(i) + ".temp").c_str()); } }
+ if (m->control_pressed) { dFile.close(); for (int i = 0; i < numGroups; i++) { m->mothurRemove((distFile + "." + toString(i) + ".temp")); } }
dFile >> seqA >> seqB >> dist; m->gobble(dFile);
dFile.close();
for (int i = 0; i < numGroups; i++) { //remove old temp files, just in case
- remove((namefile + "." + toString(i) + ".temp").c_str());
+ m->mothurRemove((namefile + "." + toString(i) + ".temp"));
//write out any remaining buffers
if (numOutputs[i] > 0) {
remainingNames << name << '\t' << nameList << endl;
}
in.close();
- remove(tempNameFile.c_str());
+ m->mothurRemove(tempNameFile);
}
}
remainingNames.close();
if (!wroteExtra) {
- remove(singleton.c_str());
+ m->mothurRemove(singleton);
singleton = "none";
}
if (m->control_pressed) {
for (int i = 0; i < dists.size(); i++) {
- remove((dists[i].begin()->first).c_str());
- remove((dists[i].begin()->second).c_str());
+ m->mothurRemove((dists[i].begin()->first));
+ m->mothurRemove((dists[i].begin()->second));
}
dists.clear();
}
dFile >> seqA >> seqB >> dist;
- if (m->control_pressed) { dFile.close(); for(int i=0;i<numGroups;i++){ if(groups[i].size() > 0){ remove((distFile + "." + toString(i) + ".temp").c_str()); } } return 0; }
+ if (m->control_pressed) { dFile.close(); for(int i=0;i<numGroups;i++){ if(groups[i].size() > 0){ m->mothurRemove((distFile + "." + toString(i) + ".temp")); } } return 0; }
if(dist < cutoff){
//cout << "in cutoff: " << dist << endl;
delete memblock;
fileB.close();
- remove(fileName2.c_str());
+ m->mothurRemove(fileName2);
//write out the merged memory
if (numOutputs[groupID] > 60) {
delete memblock;
fileB.close();
- remove(fileName2.c_str());
+ m->mothurRemove(fileName2);
//write out the merged memory
if (numOutputs[groupID] > 60) {
if (m->control_pressed) {
for (int i = 0; i < dists.size(); i++) {
- remove((dists[i].begin()->first).c_str());
- remove((dists[i].begin()->second).c_str());
+ m->mothurRemove((dists[i].begin()->first));
+ m->mothurRemove((dists[i].begin()->second));
}
dists.clear();
}
dFile >> seqA >> seqB >> dist;
- if (m->control_pressed) { dFile.close(); for(int i=0;i<numGroups;i++){ if(groups[i].size() > 0){ remove((distFile + "." + toString(i) + ".temp").c_str()); } } return 0; }
+ if (m->control_pressed) { dFile.close(); for(int i=0;i<numGroups;i++){ if(groups[i].size() > 0){ m->mothurRemove((distFile + "." + toString(i) + ".temp")); } } return 0; }
if(dist < cutoff){
//cout << "in cutoff: " << dist << endl;
if (abort == true) { if (calledHelp) { return 0; } return 2; }
if (sharedfile != "") { getSubSampleShared(); }
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); return 0; } }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); return 0; } }
if (listfile != "") { getSubSampleList(); }
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); return 0; } }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); return 0; } }
if (rabundfile != "") { getSubSampleRabund(); }
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); return 0; } }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); return 0; } }
if (sabundfile != "") { getSubSampleSabund(); }
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); return 0; } }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); return 0; } }
if (fastafile != "") { getSubSampleFasta(); }
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); return 0; } }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); return 0; } }
//set fasta file as new current fastafile
string current = "";
}
//if the users entered no valid calculators don't execute command
- if (sumCalculators.size() == 0) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (sumCalculators.size() == 0) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
ofstream outputFileHandle;
m->openOutputFile(fileNameRoot, outputFileHandle);
set<string> processedLabels;
set<string> userLabels = labels;
- if (m->control_pressed) { outputFileHandle.close(); for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } for(int i=0;i<sumCalculators.size();i++){ delete sumCalculators[i]; } delete sabund; delete input; return 0; }
+ if (m->control_pressed) { outputFileHandle.close(); for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } for(int i=0;i<sumCalculators.size();i++){ delete sumCalculators[i]; } delete sabund; delete input; return 0; }
while((sabund != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
- if (m->control_pressed) { outputFileHandle.close(); for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } for(int i=0;i<sumCalculators.size();i++){ delete sumCalculators[i]; } delete sabund; delete input; return 0; }
+ if (m->control_pressed) { outputFileHandle.close(); for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } for(int i=0;i<sumCalculators.size();i++){ delete sumCalculators[i]; } delete sabund; delete input; return 0; }
if(allLines == 1 || labels.count(sabund->getLabel()) == 1){
for(int i=0;i<sumCalculators.size();i++){
vector<double> data = sumCalculators[i]->getValues(sabund);
- if (m->control_pressed) { outputFileHandle.close(); for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } for(int i=0;i<sumCalculators.size();i++){ delete sumCalculators[i]; } delete sabund; delete input; return 0; }
+ if (m->control_pressed) { outputFileHandle.close(); for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } for(int i=0;i<sumCalculators.size();i++){ delete sumCalculators[i]; } delete sabund; delete input; return 0; }
outputFileHandle << '\t';
sumCalculators[i]->print(outputFileHandle);
for(int i=0;i<sumCalculators.size();i++){
vector<double> data = sumCalculators[i]->getValues(sabund);
- if (m->control_pressed) { outputFileHandle.close(); for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } for(int i=0;i<sumCalculators.size();i++){ delete sumCalculators[i]; } delete sabund; delete input; return 0; }
+ if (m->control_pressed) { outputFileHandle.close(); for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } for(int i=0;i<sumCalculators.size();i++){ delete sumCalculators[i]; } delete sabund; delete input; return 0; }
outputFileHandle << '\t';
sumCalculators[i]->print(outputFileHandle);
sabund = input->getSAbundVector();
}
- if (m->control_pressed) { outputFileHandle.close(); for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } for(int i=0;i<sumCalculators.size();i++){ delete sumCalculators[i]; } delete input; return 0; }
+ if (m->control_pressed) { outputFileHandle.close(); for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } for(int i=0;i<sumCalculators.size();i++){ delete sumCalculators[i]; } delete input; return 0; }
//output error messages about any remaining user labels
set<string>::iterator it;
for(int i=0;i<sumCalculators.size();i++){
vector<double> data = sumCalculators[i]->getValues(sabund);
- if (m->control_pressed) { outputFileHandle.close(); for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } for(int i=0;i<sumCalculators.size();i++){ delete sumCalculators[i]; } delete sabund; delete input; return 0; }
+ if (m->control_pressed) { outputFileHandle.close(); for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } for(int i=0;i<sumCalculators.size();i++){ delete sumCalculators[i]; } delete sabund; delete input; return 0; }
outputFileHandle << '\t';
sumCalculators[i]->print(outputFileHandle);
outputFileHandle.close();
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } for(int i=0;i<sumCalculators.size();i++){ delete sumCalculators[i]; } delete input; return 0; }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } for(int i=0;i<sumCalculators.size();i++){ delete sumCalculators[i]; } delete input; return 0; }
delete input;
for(int i=0;i<sumCalculators.size();i++){ delete sumCalculators[i]; }
}
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
//create summary file containing all the groups data for each label - this function just combines the info from the files already created.
if ((sharedfile != "") && (groupMode)) { outputNames.push_back(createGroupSummaryFile(numLines, numCols, outputNames)); }
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
m->mothurOutEndLine();
m->mothurOut("Output File Names: "); m->mothurOutEndLine();
//clears file before we start to write to it below
for (int i=0; i<lookup.size(); i++) {
- remove((sharedFileRoot + lookup[i]->getGroup() + ".rabund").c_str());
+ m->mothurRemove((sharedFileRoot + lookup[i]->getGroup() + ".rabund"));
filenames.push_back((sharedFileRoot + lookup[i]->getGroup() + ".rabund"));
}
files[outputNames[i]] = thisFilesLines;
temp.close();
- remove(outputNames[i].c_str());
+ m->mothurRemove(outputNames[i]);
}
//output label line to new file
for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; }
//close files and clean up
- remove(outputFileName.c_str());
- if (mult == true) { remove(outAllFileName.c_str()); }
+ m->mothurRemove(outputFileName);
+ if (mult == true) { m->mothurRemove(outAllFileName); }
return 0;
//if you only have 2 groups you don't need a .sharedmultiple file
}else if ((lookup.size() == 2) && (mult == true)) {
mult = false;
- remove(outAllFileName.c_str());
+ m->mothurRemove(outAllFileName);
outputNames.pop_back();
}
if (m->control_pressed) {
- if (mult) { remove(outAllFileName.c_str()); }
- remove(outputFileName.c_str());
+ if (mult) { m->mothurRemove(outAllFileName); }
+ m->mothurRemove(outputFileName);
delete input;
for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; }
for(int i=0;i<sumCalculators.size();i++){ delete sumCalculators[i]; }
//as long as you are not at the end of the file or done wih the lines you want
while((lookup[0] != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
if (m->control_pressed) {
- if (mult) { remove(outAllFileName.c_str()); }
- remove(outputFileName.c_str());
+ if (mult) { m->mothurRemove(outAllFileName); }
+ m->mothurRemove(outputFileName);
delete input;
for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; }
for(int i=0;i<sumCalculators.size();i++){ delete sumCalculators[i]; }
}
if (m->control_pressed) {
- if (mult) { remove(outAllFileName.c_str()); }
- remove(outputFileName.c_str());
+ if (mult) { m->mothurRemove(outAllFileName); }
+ m->mothurRemove(outputFileName);
delete input;
for(int i=0;i<sumCalculators.size();i++){ delete sumCalculators[i]; }
m->Groups.clear();
delete input;
if (m->control_pressed) {
- remove(outAllFileName.c_str());
- remove(outputFileName.c_str());
+ m->mothurRemove(outAllFileName);
+ m->mothurRemove(outputFileName);
return 0;
}
if(processors == 1){
driver(thisLookup, 0, numGroups, sumFileName+".temp", sumAllFileName+".temp", calcDists);
m->appendFiles((sumFileName + ".temp"), sumFileName);
- remove((sumFileName + ".temp").c_str());
+ m->mothurRemove((sumFileName + ".temp"));
if (mult) {
m->appendFiles((sumAllFileName + ".temp"), sumAllFileName);
- remove((sumAllFileName + ".temp").c_str());
+ m->mothurRemove((sumAllFileName + ".temp"));
}
}else{
int process = 1;
//parent do your part
driver(thisLookup, lines[0].start, lines[0].end, sumFileName + toString(getpid()) + ".temp", sumAllFileName + toString(getpid()) + ".temp", calcDists);
m->appendFiles((sumFileName + toString(getpid()) + ".temp"), sumFileName);
- remove((sumFileName + toString(getpid()) + ".temp").c_str());
+ m->mothurRemove((sumFileName + toString(getpid()) + ".temp"));
if (mult) { m->appendFiles((sumAllFileName + toString(getpid()) + ".temp"), sumAllFileName); }
//force parent to wait until all the processes are done
for (int i = 0; i < processIDS.size(); i++) {
m->appendFiles((sumFileName + toString(processIDS[i]) + ".temp"), sumFileName);
- remove((sumFileName + toString(processIDS[i]) + ".temp").c_str());
- if (mult) { remove((sumAllFileName + toString(processIDS[i]) + ".temp").c_str()); }
+ m->mothurRemove((sumFileName + toString(processIDS[i]) + ".temp"));
+ if (mult) { m->mothurRemove((sumAllFileName + toString(processIDS[i]) + ".temp")); }
if (createPhylip) {
string tempdistFileName = m->getRootName(m->getSimpleName(sumFileName)) + toString(processIDS[i]) + ".dist";
}
}
intemp.close();
- remove(tempdistFileName.c_str());
+ m->mothurRemove(tempdistFileName);
}
}
#else
driver(thisLookup, 0, numGroups, (sumFileName + ".temp"), (sumAllFileName + ".temp"), calcDists);
m->appendFiles((sumFileName + ".temp"), sumFileName);
- remove((sumFileName + ".temp").c_str());
+ m->mothurRemove((sumFileName + ".temp"));
if (mult) {
m->appendFiles((sumAllFileName + ".temp"), sumAllFileName);
- remove((sumAllFileName + ".temp").c_str());
+ m->mothurRemove((sumAllFileName + ".temp"));
}
#endif
in.close();
m->mothurOut(output); m->mothurOutEndLine();
- remove(filename.c_str());
+ m->mothurRemove(filename);
return 0;
}
in.close();
out.close();
- if (m->control_pressed) { remove(equalizedFile.c_str()); }
+ if (m->control_pressed) { m->mothurRemove(equalizedFile); }
}else { inTax.close(); }
}
//create tree file
makeSimsShared();
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
}else{
//read in dist file
filename = inputfile;
//delete tree
delete t;
- if (m->control_pressed) { remove(outputFile.c_str()); outputNames.pop_back(); return 1; }
+ if (m->control_pressed) { m->mothurRemove(outputFile); outputNames.pop_back(); return 1; }
return 0;
}
if(size < 10){
- remove(barcodePrimerComboFileNames[i][j].c_str());
+ m->mothurRemove(barcodePrimerComboFileNames[i][j]);
}
else{
output << barcodePrimerComboFileNames[i][j] << endl;
m->mothurOut("Appending files from process " + toString(processIDS[i])); m->mothurOutEndLine();
m->appendFiles((trimFlowFileName + toString(processIDS[i]) + ".temp"), trimFlowFileName);
- remove((trimFlowFileName + toString(processIDS[i]) + ".temp").c_str());
+ m->mothurRemove((trimFlowFileName + toString(processIDS[i]) + ".temp"));
// m->mothurOut("\tDone with trim.flow file"); m->mothurOutEndLine();
m->appendFiles((scrapFlowFileName + toString(processIDS[i]) + ".temp"), scrapFlowFileName);
- remove((scrapFlowFileName + toString(processIDS[i]) + ".temp").c_str());
+ m->mothurRemove((scrapFlowFileName + toString(processIDS[i]) + ".temp"));
// m->mothurOut("\tDone with scrap.flow file"); m->mothurOutEndLine();
if(fasta){
m->appendFiles((fastaFileName + toString(processIDS[i]) + ".temp"), fastaFileName);
- remove((fastaFileName + toString(processIDS[i]) + ".temp").c_str());
+ m->mothurRemove((fastaFileName + toString(processIDS[i]) + ".temp"));
// m->mothurOut("\tDone with flow.fasta file"); m->mothurOutEndLine();
}
if(allFiles){
for (int j = 0; j < barcodePrimerComboFileNames.size(); j++) {
for (int k = 0; k < barcodePrimerComboFileNames[0].size(); k++) {
m->appendFiles((barcodePrimerComboFileNames[j][k] + toString(processIDS[i]) + ".temp"), barcodePrimerComboFileNames[j][k]);
- remove((barcodePrimerComboFileNames[j][k] + toString(processIDS[i]) + ".temp").c_str());
+ m->mothurRemove((barcodePrimerComboFileNames[j][k] + toString(processIDS[i]) + ".temp"));
}
}
}
if (fastaFileNames[i][j] != "") {
if (namesToRemove.count(fastaFileNames[i][j]) == 0) {
if(m->isBlank(fastaFileNames[i][j])){
- remove(fastaFileNames[i][j].c_str());
+ m->mothurRemove(fastaFileNames[i][j]);
namesToRemove.insert(fastaFileNames[i][j]);
if(qFileName != ""){
- remove(qualFileNames[i][j].c_str());
+ m->mothurRemove(qualFileNames[i][j]);
namesToRemove.insert(qualFileNames[i][j]);
}
if(nameFile != ""){
- remove(nameFileNames[i][j].c_str());
+ m->mothurRemove(nameFileNames[i][j]);
namesToRemove.insert(nameFileNames[i][j]);
}
}else{
}
}
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
//output group counts
m->mothurOutEndLine();
}
if (total != 0) { m->mothurOut("Total of all groups is " + toString(total)); m->mothurOutEndLine(); }
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
//set fasta file as new current fastafile
string current = "";
if(qFileName != ""){
qFile.close();
}
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); }
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); }
return 0;
}
int currentSeqsDiffs = 0;
Sequence currSeq(inFASTA); m->gobble(inFASTA);
+ //cout << currSeq.getName() << '\t' << currSeq.getUnaligned().length() << endl;
QualityScores currQual;
if(qFileName != ""){
currQual = QualityScores(qFile); m->gobble(qFile);
}
- //cout << currSeq.getName() << '\t' << currSeq.getUnaligned().length() << endl;
+
string origSeq = currSeq.getUnaligned();
if (origSeq != "") {
m->mothurOut("Appending files from process " + toString(processIDS[i])); m->mothurOutEndLine();
m->appendFiles((trimFASTAFileName + toString(processIDS[i]) + ".temp"), trimFASTAFileName);
- remove((trimFASTAFileName + toString(processIDS[i]) + ".temp").c_str());
+ m->mothurRemove((trimFASTAFileName + toString(processIDS[i]) + ".temp"));
m->appendFiles((scrapFASTAFileName + toString(processIDS[i]) + ".temp"), scrapFASTAFileName);
- remove((scrapFASTAFileName + toString(processIDS[i]) + ".temp").c_str());
+ m->mothurRemove((scrapFASTAFileName + toString(processIDS[i]) + ".temp"));
if(qFileName != ""){
m->appendFiles((trimQualFileName + toString(processIDS[i]) + ".temp"), trimQualFileName);
- remove((trimQualFileName + toString(processIDS[i]) + ".temp").c_str());
+ m->mothurRemove((trimQualFileName + toString(processIDS[i]) + ".temp"));
m->appendFiles((scrapQualFileName + toString(processIDS[i]) + ".temp"), scrapQualFileName);
- remove((scrapQualFileName + toString(processIDS[i]) + ".temp").c_str());
+ m->mothurRemove((scrapQualFileName + toString(processIDS[i]) + ".temp"));
}
if(nameFile != ""){
m->appendFiles((trimNameFileName + toString(processIDS[i]) + ".temp"), trimNameFileName);
- remove((trimNameFileName + toString(processIDS[i]) + ".temp").c_str());
+ m->mothurRemove((trimNameFileName + toString(processIDS[i]) + ".temp"));
m->appendFiles((scrapNameFileName + toString(processIDS[i]) + ".temp"), scrapNameFileName);
- remove((scrapNameFileName + toString(processIDS[i]) + ".temp").c_str());
+ m->mothurRemove((scrapNameFileName + toString(processIDS[i]) + ".temp"));
}
if(oligoFile != ""){
m->appendFiles((groupFile + toString(processIDS[i]) + ".temp"), groupFile);
- remove((groupFile + toString(processIDS[i]) + ".temp").c_str());
+ m->mothurRemove((groupFile + toString(processIDS[i]) + ".temp"));
}
for(int k=0;k<fastaFileNames[j].size();k++){
if (fastaFileNames[j][k] != "") {
m->appendFiles((fastaFileNames[j][k] + toString(processIDS[i]) + ".temp"), fastaFileNames[j][k]);
- remove((fastaFileNames[j][k] + toString(processIDS[i]) + ".temp").c_str());
+ m->mothurRemove((fastaFileNames[j][k] + toString(processIDS[i]) + ".temp"));
if(qFileName != ""){
m->appendFiles((qualFileNames[j][k] + toString(processIDS[i]) + ".temp"), qualFileNames[j][k]);
- remove((qualFileNames[j][k] + toString(processIDS[i]) + ".temp").c_str());
+ m->mothurRemove((qualFileNames[j][k] + toString(processIDS[i]) + ".temp"));
}
if(nameFile != ""){
m->appendFiles((nameFileNames[j][k] + toString(processIDS[i]) + ".temp"), nameFileNames[j][k]);
- remove((nameFileNames[j][k] + toString(processIDS[i]) + ".temp").c_str());
+ m->mothurRemove((nameFileNames[j][k] + toString(processIDS[i]) + ".temp"));
}
}
}
else { groupCounts[it->first] += tempNum; }
}
}
- in.close(); remove(tempFile.c_str());
+ in.close(); m->mothurRemove(tempFile);
}
}
if (m->control_pressed) {
delete tmap; for (int i = 0; i < T.size(); i++) { delete T[i]; }
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear();
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear();
m->Groups.clear();
return 0;
}
delete tmap; delete unweighted;
for (int i = 0; i < T.size(); i++) { delete T[i]; }
outSum.close();
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); }
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); }
return 0;
}
userData = unweighted->getValues(T[i], processors, outputDir); //userData[0] = unweightedscore
if (m->control_pressed) { delete tmap; delete unweighted;
- for (int i = 0; i < T.size(); i++) { delete T[i]; }if (random) { delete output; } outSum.close(); for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); }return 0; }
+ for (int i = 0; i < T.size(); i++) { delete T[i]; }if (random) { delete output; } outSum.close(); for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); }return 0; }
//output scores for each combination
for(int k = 0; k < numComp; k++) {
randomData = unweighted->getValues(T[i], "", "", processors, outputDir);
if (m->control_pressed) { delete tmap; delete unweighted;
- for (int i = 0; i < T.size(); i++) { delete T[i]; }if (random) { delete output; } outSum.close(); for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ for (int i = 0; i < T.size(); i++) { delete T[i]; }if (random) { delete output; } outSum.close(); for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
for(int k = 0; k < numComp; k++) {
//add trees unweighted score to map of scores
}
if (m->control_pressed) { delete tmap; delete unweighted;
- for (int i = 0; i < T.size(); i++) { delete T[i]; }if (random) { delete output; } outSum.close(); for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ for (int i = 0; i < T.size(); i++) { delete T[i]; }if (random) { delete output; } outSum.close(); for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
//print output files
printUWSummaryFile(i);
delete tmap; delete unweighted;
for (int i = 0; i < T.size(); i++) { delete T[i]; }
- if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ if (m->control_pressed) { for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
m->mothurOut("It took " + toString(time(NULL) - start) + " secs to run unifrac.unweighted."); m->mothurOutEndLine();
if (m->control_pressed) {
delete tmap; for (int i = 0; i < T.size(); i++) { delete T[i]; }
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } outputTypes.clear();
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } outputTypes.clear();
m->Groups.clear();
return 0;
}
for (int i = 0; i < T.size(); i++) {
if (m->control_pressed) { delete tmap; delete weighted;
- for (int i = 0; i < T.size(); i++) { delete T[i]; } outSum.close(); for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ for (int i = 0; i < T.size(); i++) { delete T[i]; } outSum.close(); for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
counter = 0;
rScores.resize(numComp); //data[0] = weightedscore AB, data[1] = weightedscore AC...
userData = weighted->getValues(T[i], processors, outputDir); //userData[0] = weightedscore
if (m->control_pressed) { delete tmap; delete weighted;
- for (int i = 0; i < T.size(); i++) { delete T[i]; } if (random) { delete output; } outSum.close(); for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ for (int i = 0; i < T.size(); i++) { delete T[i]; } if (random) { delete output; } outSum.close(); for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
//save users score
for (int s=0; s<numComp; s++) {
#endif
if (m->control_pressed) { delete tmap; delete weighted;
- for (int i = 0; i < T.size(); i++) { delete T[i]; } delete output; outSum.close(); for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ for (int i = 0; i < T.size(); i++) { delete T[i]; } delete output; outSum.close(); for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
//report progress
// m->mothurOut("Iter: " + toString(j+1)); m->mothurOutEndLine();
if (m->control_pressed) { delete tmap; delete weighted;
- for (int i = 0; i < T.size(); i++) { delete T[i]; } outSum.close(); for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); } return 0; }
+ for (int i = 0; i < T.size(); i++) { delete T[i]; } outSum.close(); for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); } return 0; }
printWSummaryFile();
if (m->control_pressed) {
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); }
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); }
return 0;
}
double tempScore;
for (int j = lines[(i+1)].start; j < (lines[(i+1)].start + lines[(i+1)].num); j++) { in >> tempScore; scores[j].push_back(tempScore); }
in.close();
- remove(s.c_str());
+ m->mothurRemove(s);
}
return 0;
m->gobble(in);
}
in.close();
- remove(s.c_str());
+ m->mothurRemove(s);
}
m->mothurOut("DONE."); m->mothurOutEndLine(); m->mothurOutEndLine();
m->gobble(in);
}
in.close();
- remove(s.c_str());
+ m->mothurRemove(s);
}
return results;
for (int i = 0; i < vennCalculators.size(); i++) { delete vennCalculators[i]; }
for (int i = 0; i < lookup.size(); i++) { delete lookup[i]; }
m->Groups.clear(); delete venn; delete input;
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); }
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); }
return 0;
}
if (m->control_pressed) {
for (int i = 0; i < vennCalculators.size(); i++) { delete vennCalculators[i]; }
m->Groups.clear(); delete venn; delete input;
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); }
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); }
return 0;
}
if (m->control_pressed) {
m->Groups.clear(); delete venn; delete input;
for (int i = 0; i < vennCalculators.size(); i++) { delete vennCalculators[i]; }
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); }
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); }
return 0;
}
if (m->control_pressed) {
for (int i = 0; i < vennCalculators.size(); i++) { delete vennCalculators[i]; }
delete sabund; delete venn; delete input;
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); }
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); }
return 0;
}
if (m->control_pressed) {
for (int i = 0; i < vennCalculators.size(); i++) { delete vennCalculators[i]; }
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); }
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); }
delete venn; delete input;
return 0;
}
if (m->control_pressed) {
delete venn; delete input;
for (int i = 0; i < vennCalculators.size(); i++) { delete vennCalculators[i]; }
- for (int i = 0; i < outputNames.size(); i++) { remove(outputNames[i].c_str()); }
+ for (int i = 0; i < outputNames.size(); i++) { m->mothurRemove(outputNames[i]); }
return 0;
}
}
m->gobble(in);
}
in.close();
- remove(s.c_str());
+ m->mothurRemove(s);
}
m->mothurOut("DONE."); m->mothurOutEndLine(); m->mothurOutEndLine();