X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=sffinfocommand.h;h=12f0180db565edf8818455648eadcc19107ec5ab;hp=837435b3a6ca4c4c7f2e7e7579141b8fbece342b;hb=b206f634aae1b4ce13978d203247fb64757d5482;hpb=91a27e0483827c06c21c4fe89558923bbfe86573 diff --git a/sffinfocommand.h b/sffinfocommand.h index 837435b..12f0180 100644 --- a/sffinfocommand.h +++ b/sffinfocommand.h @@ -11,52 +11,8 @@ */ #include "command.hpp" +#include "groupmap.h" - -/**********************************************************/ -struct CommonHeader { - unsigned int magicNumber; - string version; - unsigned long long indexOffset; - unsigned int indexLength; - unsigned int numReads; - unsigned short headerLength; - unsigned short keyLength; - unsigned short numFlowsPerRead; - int flogramFormatCode; - string flowChars; //length depends on number flow reads - string keySequence; //length depends on key length - - CommonHeader(){ magicNumber=0; indexOffset=0; indexLength=0; numReads=0; headerLength=0; keyLength=0; numFlowsPerRead=0; flogramFormatCode='s'; } - ~CommonHeader() { } -}; -/**********************************************************/ -struct Header { - unsigned short headerLength; - unsigned short nameLength; - unsigned int numBases; - unsigned short clipQualLeft; - unsigned short clipQualRight; - unsigned short clipAdapterLeft; - unsigned short clipAdapterRight; - string name; //length depends on nameLength - string timestamp; - string region; - string xy; - - Header() { headerLength=0; nameLength=0; numBases=0; clipQualLeft=0; clipQualRight=0; clipAdapterLeft=0; clipAdapterRight=0; } - ~Header() { } -}; -/**********************************************************/ -struct seqRead { - vector flowgram; - vector flowIndex; - string bases; - vector qualScores; - - seqRead() { } - ~seqRead() { } -}; /**********************************************************/ class SffInfoCommand : public Command { @@ -69,7 +25,9 @@ public: vector setParameters(); string getCommandName() { return "sffinfo"; } string getCommandCategory() { return "Sequence Processing"; } + string getHelpString(); + string getOutputPattern(string); string getCitation() { return "http://www.mothur.org/wiki/Sffinfo"; } string getDescription() { return "extract sequences reads from a .sff file"; } @@ -77,18 +35,27 @@ public: void help() { m->mothurOut(getHelpString()); } private: - string sffFilename, sfftxtFilename, outputDir, accnosName; - vector filenames, outputNames, accnosFileNames; - bool abort, fasta, qual, trim, flow, sfftxt, hasAccnos; - int mycount; + string sffFilename, sfftxtFilename, outputDir, accnosName, currentFileName, oligosfile, noMatchFile, groupfile; + vector filenames, outputNames, accnosFileNames, oligosFileNames, groupFileNames; + bool abort, fasta, qual, trim, flow, sfftxt, hasAccnos, hasOligos, hasGroup; + int mycount, split, numFPrimers, numLinkers, numSpacers, pdiffs, bdiffs, ldiffs, sdiffs, tdiffs, numNoMatch; set seqNames; + map barcodes; + map primers; + GroupMap* groupMap; + vector linker, spacer, primerNameVector, barcodeNameVector, revPrimer; + vector > numSplitReads; + vector > filehandles; + vector > filehandlesHeaders; //extract sff file functions - int extractSffInfo(string, string); + int extractSffInfo(string, string, string); int readCommonHeader(ifstream&, CommonHeader&); int readHeader(ifstream&, Header&); - int readSeqData(ifstream&, seqRead&, int, int); + bool readSeqData(ifstream&, seqRead&, int, Header&); int decodeName(string&, string&, string&, string); + bool readOligos(string oligosFile); + bool readGroup(string oligosFile); int printCommonHeader(ofstream&, CommonHeader&); int printHeader(ofstream&, Header&); @@ -99,6 +66,10 @@ private: int readAccnosFile(string); int parseSffTxt(); bool sanityCheck(Header&, seqRead&); + int adjustCommonHeader(CommonHeader); + int findGroup(Header header, seqRead read, int& barcode, int& primer); + int findGroup(Header header, seqRead read, int& barcode, int& primer, string); + string reverseOligo(string oligo); //parsesfftxt file functions int parseHeaderLineToInt(ifstream&);