X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=pcrseqscommand.h;h=16c1e29be5f9cbba00180a55a746bbe923b3cbdb;hp=420a5ebc3e4b0cb527a3c2c692797c0b627c3b46;hb=1a20e24ee786195ab0e1cccd4f5aede7a88f3f4e;hpb=dec4333b64891e0b923c862446cf2e3befa7e3d3 diff --git a/pcrseqscommand.h b/pcrseqscommand.h index 420a5eb..16c1e29 100644 --- a/pcrseqscommand.h +++ b/pcrseqscommand.h @@ -15,6 +15,7 @@ #include "trimoligos.h" #include "alignment.hpp" #include "needlemanoverlap.hpp" +#include "counttable.h" class PcrSeqsCommand : public Command { public: @@ -25,7 +26,9 @@ public: vector setParameters(); string getCommandName() { return "pcr.seqs"; } string getCommandCategory() { return "Sequence Processing"; } + string getHelpString(); + string getOutputPattern(string); string getCitation() { return "http://www.mothur.org/wiki/Pcr.seqs"; } string getDescription() { return "pcr.seqs"; } @@ -44,24 +47,22 @@ private: vector lines; bool getOligos(vector >&, vector >&, vector >&); bool abort, keepprimer, keepdots; - string fastafile, oligosfile, taxfile, groupfile, namefile, ecolifile, outputDir, nomatch; - int start, end, processors, length; + string fastafile, oligosfile, taxfile, groupfile, namefile, countfile, ecolifile, outputDir, nomatch; + int start, end, processors, length, pdiffs; vector revPrimer, outputNames; - vector primers; + map primers; int writeAccnos(set); int readName(set&); int readGroup(set); int readTax(set); + int readCount(set); bool readOligos(); bool readEcoli(); int driverPcr(string, string, string, set&, linePair); int createProcesses(string, string, string, set&); - bool findForward(Sequence&, int&, int&); - bool findReverse(Sequence&, int&, int&); bool isAligned(string, map&); - bool compareDNASeq(string, string); string reverseOligo(string); }; @@ -74,16 +75,16 @@ struct pcrData { string goodFasta, badFasta, oligosfile, ecolifile, nomatch; unsigned long long fstart; unsigned long long fend; - int count, start, end, length; + int count, start, end, length, pdiffs; MothurOut* m; - vector primers; + map primers; vector revPrimer; set badSeqNames; bool keepprimer, keepdots; pcrData(){} - pcrData(string f, string gf, string bfn, MothurOut* mout, string ol, string ec, vector pr, vector rpr, string nm, bool kp, bool kd, int st, int en, int l, unsigned long long fst, unsigned long long fen) { + pcrData(string f, string gf, string bfn, MothurOut* mout, string ol, string ec, map pr, vector rpr, string nm, bool kp, bool kd, int st, int en, int l, int pd, unsigned long long fst, unsigned long long fen) { filename = f; goodFasta = gf; badFasta = bfn; @@ -100,6 +101,7 @@ struct pcrData { length = l; fstart = fst; fend = fen; + pdiffs = pd; count = 0; } }; @@ -128,9 +130,12 @@ static DWORD WINAPI MyPcrThreadFunction(LPVOID lpParam){ } set lengths; - pDataArray->count = pDataArray->fend; + //pdiffs, bdiffs, primers, barcodes, revPrimers + map faked; + TrimOligos trim(pDataArray->pdiffs, 0, pDataArray->primers, faked, pDataArray->revPrimer); + for(int i = 0; i < pDataArray->fend; i++){ //end is the number of sequences to process - + pDataArray->count++; if (pDataArray->m->control_pressed) { break; } Sequence currSeq(inFASTA); pDataArray->m->gobble(inFASTA); @@ -156,62 +161,7 @@ static DWORD WINAPI MyPcrThreadFunction(LPVOID lpParam){ //process primers if (pDataArray->primers.size() != 0) { int primerStart = 0; int primerEnd = 0; - //bool good = findForward(currSeq, primerStart, primerEnd); - /////////////////////////////////////////////////////////////// - bool good = false; - string rawSequence = currSeq.getUnaligned(); - - for(int j=0;jprimers.size();j++){ - string oligo = pDataArray->primers[j]; - - if (pDataArray->m->control_pressed) { primerStart = 0; primerEnd = 0; good = false; break; } - - if(rawSequence.length() < oligo.length()) { break; } - - //search for primer - int olength = oligo.length(); - for (int l = 0; l < rawSequence.length()-olength; l++){ - if (pDataArray->m->control_pressed) { primerStart = 0; primerEnd = 0; good = false; break; } - string rawChunk = rawSequence.substr(l, olength); - //compareDNASeq(oligo, rawChunk) - //////////////////////////////////////////////////////// - bool success = 1; - for(int k=0;knomatch == "reject") { goodSeq = false; } trashCode += "f"; } else{ @@ -225,6 +175,15 @@ static DWORD WINAPI MyPcrThreadFunction(LPVOID lpParam){ if (pDataArray->keepdots) { currSeq.filterToPos(mapAligned[primerStart]); } else { currSeq.setAligned(currSeq.getAligned().substr(mapAligned[primerStart])); } } + /////////////////////////////////////////////////////////////// + mapAligned.clear(); + string seq = currSeq.getAligned(); + int countBases = 0; + for (int k = 0; k < seq.length(); k++) { + if (!isalpha(seq[k])) { ; } + else { mapAligned[countBases] = k; countBases++; } + } + /////////////////////////////////////////////////////////////// }else { if (!pDataArray->keepprimer) { currSeq.setAligned(currSeq.getUnaligned().substr(primerEnd)); } else { currSeq.setAligned(currSeq.getUnaligned().substr(primerStart)); } @@ -235,60 +194,8 @@ static DWORD WINAPI MyPcrThreadFunction(LPVOID lpParam){ //process reverse primers if (pDataArray->revPrimer.size() != 0) { int primerStart = 0; int primerEnd = 0; - bool good = false; - //findReverse(currSeq, primerStart, primerEnd); - /////////////////////////////////////////////////////////////// - string rawSequence = currSeq.getUnaligned(); - - for(int j=0;jrevPrimer.size();j++){ - string oligo = pDataArray->revPrimer[j]; - if (pDataArray->m->control_pressed) { primerStart = 0; primerEnd = 0; good = false; break; } - if(rawSequence.length() < oligo.length()) { break; } - - //search for primer - int olength = oligo.length(); - for (int l = rawSequence.length()-olength; l >= 0; l--){ - - string rawChunk = rawSequence.substr(l, olength); - //compareDNASeq(oligo, rawChunk) - //////////////////////////////////////////////////////// - bool success = 1; - for(int k=0;knomatch == "reject") { goodSeq = false; } trashCode += "r"; } else{ //are you aligned