X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=screenseqscommand.cpp;h=ff5f4650c73d3b71c6e76f7398603e711f788859;hb=aca78ed4a47dff8672ea8fd93cef0dfbaf0f7495;hp=d2fbe935356a2f0752efa683a893a5892e1b2eb2;hpb=c48d91112209b841444923670dca5454da0e2a4d;p=mothur.git diff --git a/screenseqscommand.cpp b/screenseqscommand.cpp index d2fbe93..ff5f465 100644 --- a/screenseqscommand.cpp +++ b/screenseqscommand.cpp @@ -14,7 +14,7 @@ vector ScreenSeqsCommand::setParameters(){ try { CommandParameter pfasta("fasta", "InputTypes", "", "", "none", "none", "none","fasta",false,true,true); parameters.push_back(pfasta); - CommandParameter pcontigsreport("contigsreport", "InputTypes", "", "", "report", "none", "none","contigsreport",false,true,true); parameters.push_back(pcontigsreport); + CommandParameter pcontigsreport("contigsreport", "InputTypes", "", "", "report", "none", "none","contigsreport",false,false,true); parameters.push_back(pcontigsreport); CommandParameter palignreport("alignreport", "InputTypes", "", "", "report", "none", "none","alignreport",false,false); parameters.push_back(palignreport); CommandParameter psummary("summary", "InputTypes", "", "", "report", "none", "none","summary",false,false); parameters.push_back(psummary); CommandParameter pname("name", "InputTypes", "", "", "NameCount", "none", "none","name",false,false,true); parameters.push_back(pname); @@ -683,7 +683,7 @@ int ScreenSeqsCommand::screenReports(map& badSeqNames){ if (namefile != "") { nameMap = m->readNames(namefile); } else if (countfile != "") { CountTable ct; - ct.readTable(countfile); + ct.readTable(countfile, true, false); nameMap = ct.getNameMap(); } getSummary(positions); @@ -714,7 +714,7 @@ int ScreenSeqsCommand::screenReports(map& badSeqNames){ if (namefile != "") { nameMap = m->readNames(namefile); } else if (countfile != "") { CountTable ct; - ct.readTable(countfile); + ct.readTable(countfile, true, false); nameMap = ct.getNameMap(); } getSummaryReport(); @@ -817,7 +817,7 @@ int ScreenSeqsCommand::screenAlignReport(map& badSeqNames){ m->mothurRemove(outSummary+".temp"); } - if (numFastaSeqs != count) { m->mothurOut("[ERROR]: found " + toString(numFastaSeqs) + " sequences in your fasta file, and " + toString(count) + " sequences in your contigs report file, quitting.\n"); m->control_pressed = true; } + if (numFastaSeqs != count) { m->mothurOut("[ERROR]: found " + toString(numFastaSeqs) + " sequences in your fasta file, and " + toString(count) + " sequences in your align report file, quitting.\n"); m->control_pressed = true; } return count; @@ -1019,7 +1019,7 @@ int ScreenSeqsCommand::screenFasta(map& badSeqNames){ if (namefile != "") { nameMap = m->readNames(namefile); } else if (countfile != "") { CountTable ct; - ct.readTable(countfile); + ct.readTable(countfile, true, false); nameMap = ct.getNameMap(); } getSummary(positions); @@ -1433,7 +1433,7 @@ int ScreenSeqsCommand::createProcessesContigsSummary(vector& oLength, vecto //loop through and create all the processes you want while (process != processors) { - int pid = fork(); + pid_t pid = fork(); if (pid > 0) { processIDS.push_back(pid); //create map from line number to pid so you can append files in correct order later @@ -1443,7 +1443,7 @@ int ScreenSeqsCommand::createProcessesContigsSummary(vector& oLength, vecto //pass numSeqs to parent ofstream out; - string tempFile = contigsreport + toString(getpid()) + ".num.temp"; + string tempFile = contigsreport + m->mothurGetpid(process) + ".num.temp"; m->openOutputFile(tempFile, out); out << num << endl; @@ -1703,7 +1703,7 @@ int ScreenSeqsCommand::createProcessesAlignSummary(vector& sims, vector 0) { processIDS.push_back(pid); //create map from line number to pid so you can append files in correct order later @@ -1713,7 +1713,7 @@ int ScreenSeqsCommand::createProcessesAlignSummary(vector& sims, vectormothurGetpid(process) + ".num.temp"; m->openOutputFile(tempFile, out); out << num << endl; @@ -1820,7 +1820,6 @@ int ScreenSeqsCommand::getSummary(vector& positions){ vector longHomoPolymer; vector numNs; - vector positions; #if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix) positions = m->divideFile(fastafile, processors); for (int i = 0; i < (positions.size()-1); i++) { lines.push_back(linePair(positions[i], positions[(i+1)])); } @@ -1845,8 +1844,9 @@ int ScreenSeqsCommand::getSummary(vector& positions){ int pid; MPI_Comm_rank(MPI_COMM_WORLD, &pid); - if (pid == 0) { - driverCreateSummary(startPosition, endPosition, seqLength, ambigBases, longHomoPolymer, numNs, fastafile, lines[0]); + if (pid == 0) { + linePair tempLine(0, positions[positions.size()-1]); + driverCreateSummary(startPosition, endPosition, seqLength, ambigBases, longHomoPolymer, numNs, fastafile, tempLine); #else int numSeqs = 0; //#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix) @@ -1986,7 +1986,7 @@ int ScreenSeqsCommand::createProcessesCreateSummary(vector& startPosition, //loop through and create all the processes you want while (process != processors) { - int pid = fork(); + pid_t pid = fork(); if (pid > 0) { processIDS.push_back(pid); //create map from line number to pid so you can append files in correct order later @@ -1996,7 +1996,7 @@ int ScreenSeqsCommand::createProcessesCreateSummary(vector& startPosition, //pass numSeqs to parent ofstream out; - string tempFile = fastafile + toString(getpid()) + ".num.temp"; + string tempFile = fastafile + m->mothurGetpid(process) + ".num.temp"; m->openOutputFile(tempFile, out); out << num << endl; @@ -2119,7 +2119,7 @@ int ScreenSeqsCommand::screenGroupFile(map badSeqNames){ while(!inputGroups.eof()){ if (m->control_pressed) { goodGroupOut.close(); inputGroups.close(); m->mothurRemove(goodGroupFile); return 0; } - inputGroups >> seqName; m->gobble(inputGroups); inputGroups >> group; + inputGroups >> seqName; m->gobble(inputGroups); inputGroups >> group; m->gobble(inputGroups); it = badSeqNames.find(seqName); if(it != badSeqNames.end()){ @@ -2128,7 +2128,6 @@ int ScreenSeqsCommand::screenGroupFile(map badSeqNames){ else{ goodGroupOut << seqName << '\t' << group << endl; } - m->gobble(inputGroups); } if (m->control_pressed) { goodGroupOut.close(); inputGroups.close(); m->mothurRemove(goodGroupFile); return 0; } @@ -2177,19 +2176,18 @@ int ScreenSeqsCommand::screenCountFile(map badSeqNames){ if (m->control_pressed) { goodCountOut.close(); in.close(); m->mothurRemove(goodCountFile); return 0; } in >> name; m->gobble(in); - in >> thisTotal; m->gobble(in); + in >> thisTotal; rest = m->getline(in); m->gobble(in); it = badSeqNames.find(name); if(it != badSeqNames.end()){ - badSeqNames.erase(it); + badSeqNames.erase(it); } else{ goodCountOut << name << '\t' << thisTotal << '\t' << rest << endl; } } - if (m->control_pressed) { goodCountOut.close(); in.close(); m->mothurRemove(goodCountFile); return 0; } //we were unable to remove some of the bad sequences @@ -2206,7 +2204,7 @@ int ScreenSeqsCommand::screenCountFile(map badSeqNames){ //check for groups that have been eliminated CountTable ct; if (ct.testGroups(goodCountFile)) { - ct.readTable(goodCountFile); + ct.readTable(goodCountFile, true, false); ct.printTable(goodCountFile); } @@ -2528,17 +2526,17 @@ int ScreenSeqsCommand::createProcesses(string goodFileName, string badAccnos, st //loop through and create all the processes you want while (process != processors) { - int pid = fork(); + pid_t pid = fork(); if (pid > 0) { processIDS.push_back(pid); //create map from line number to pid so you can append files in correct order later process++; }else if (pid == 0){ - num = driver(lines[process], goodFileName + toString(getpid()) + ".temp", badAccnos + toString(getpid()) + ".temp", filename, badSeqNames); + num = driver(lines[process], goodFileName + m->mothurGetpid(process) + ".temp", badAccnos + m->mothurGetpid(process) + ".temp", filename, badSeqNames); //pass numSeqs to parent ofstream out; - string tempFile = filename + toString(getpid()) + ".num.temp"; + string tempFile = filename + m->mothurGetpid(process) + ".num.temp"; m->openOutputFile(tempFile, out); out << num << endl; out.close();