X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=chimeraperseuscommand.cpp;h=e7294a854ec4134ccad5e17aa0ed8abb51876d09;hb=d205e70ae86dbee2efc2df02f2717975854de6ba;hp=61970d53ac38a3f9877e5a010e48bc0b336dc669;hpb=e0dc0bcef2a0f7e1f63abb531dbb1ad533da98ca;p=mothur.git diff --git a/chimeraperseuscommand.cpp b/chimeraperseuscommand.cpp index 61970d5..e7294a8 100644 --- a/chimeraperseuscommand.cpp +++ b/chimeraperseuscommand.cpp @@ -345,16 +345,16 @@ ChimeraPerseusCommand::ChimeraPerseusCommand(string option) { string temp = validParameter.validFile(parameters, "processors", false); if (temp == "not found"){ temp = m->getProcessors(); } m->setProcessors(temp); - convert(temp, processors); + m->mothurConvert(temp, processors); temp = validParameter.validFile(parameters, "cutoff", false); if (temp == "not found"){ temp = "0.50"; } - convert(temp, cutoff); + m->mothurConvert(temp, cutoff); temp = validParameter.validFile(parameters, "alpha", false); if (temp == "not found"){ temp = "-5.54"; } - convert(temp, alpha); + m->mothurConvert(temp, alpha); temp = validParameter.validFile(parameters, "cutoff", false); if (temp == "not found"){ temp = "0.33"; } - convert(temp, beta); + m->mothurConvert(temp, beta); } } catch(exception& e) { @@ -466,14 +466,15 @@ string ChimeraPerseusCommand::getNamesFile(string& inputFile){ string inputString = "fasta=" + inputFile; m->mothurOut("/******************************************/"); m->mothurOutEndLine(); m->mothurOut("Running command: unique.seqs(" + inputString + ")"); m->mothurOutEndLine(); - + m->mothurCalling = true; + Command* uniqueCommand = new DeconvoluteCommand(inputString); uniqueCommand->execute(); map > filenames = uniqueCommand->getOutputFiles(); delete uniqueCommand; - + m->mothurCalling = false; m->mothurOut("/******************************************/"); m->mothurOutEndLine(); nameFile = filenames["name"][0]; @@ -533,6 +534,7 @@ vector ChimeraPerseusCommand::loadSequences(SequenceParser& parser, str vector sequences; bool error = false; + alignLength = 0; for (int i = 0; i < thisGroupsSeqs.size(); i++) { @@ -543,6 +545,7 @@ vector ChimeraPerseusCommand::loadSequences(SequenceParser& parser, str else { int num = m->getNumNames(it->second); sequences.push_back(seqData(thisGroupsSeqs[i].getName(), thisGroupsSeqs[i].getUnaligned(), num)); + if (thisGroupsSeqs[i].getUnaligned().length() > alignLength) { alignLength = thisGroupsSeqs[i].getUnaligned().length(); } } } @@ -570,7 +573,8 @@ vector ChimeraPerseusCommand::readFiles(string inputFile, string name){ bool error = false; ifstream in; m->openInputFile(inputFile, in); - + alignLength = 0; + while (!in.eof()) { if (m->control_pressed) { in.close(); return sequences; } @@ -581,6 +585,7 @@ vector ChimeraPerseusCommand::readFiles(string inputFile, string name){ if (it == nameMap.end()) { error = true; m->mothurOut("[ERROR]: " + temp.getName() + " is in your fasta file and not in your namefile, please correct."); m->mothurOutEndLine(); } else { sequences.push_back(seqData(temp.getName(), temp.getUnaligned(), it->second)); + if (temp.getUnaligned().length() > alignLength) { alignLength = temp.getUnaligned().length(); } } } in.close(); @@ -625,7 +630,7 @@ int ChimeraPerseusCommand::driver(string chimeraFileName, vector& seque } int numSeqs = sequences.size(); - int alignLength = sequences[0].sequence.size(); + //int alignLength = sequences[0].sequence.size(); ofstream chimeraFile; ofstream accnosFile; @@ -641,7 +646,7 @@ int ChimeraPerseusCommand::driver(string chimeraFileName, vector& seque for(int i=0;icontrol_pressed) { chimeraFile.close(); m->mothurRemove(chimeraFileName); accnosFile.close(); m->mothurRemove(accnosFileName); return 0; } - + vector restricted = chimeras; vector > leftDiffs(numSeqs); @@ -662,7 +667,9 @@ int ChimeraPerseusCommand::driver(string chimeraFileName, vector& seque string dummyA, dummyB; - if(comparisons >= 2){ + if (sequences[i].sequence.size() < 3) { + chimeraFile << i << '\t' << sequences[i].seqName << "\t0\t0\tNull\t0\t0\t0\tNull\tNull\t0.0\t0.0\t0.0\t0\t0\t0\t0.0\t0.0\tgood" << endl; + }else if(comparisons >= 2){ minMismatchToChimera = myPerseus.getChimera(sequences, leftDiffs, rightDiffs, leftParentBi, rightParentBi, breakPointBi, singleLeft, bestLeft, singleRight, bestRight, restricted); if (m->control_pressed) { chimeraFile.close(); m->mothurRemove(chimeraFileName); accnosFile.close(); m->mothurRemove(accnosFileName); return 0; } @@ -762,7 +769,7 @@ int ChimeraPerseusCommand::createProcessesGroups(SequenceParser& parser, string lines.push_back(linePair(startIndex, endIndex)); } -#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) +#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux) || (__linux__) || (__unix__) || (__unix) //loop through and create all the processes you want while (process != processors) {