X-Git-Url: https://git.donarmstrong.com/?p=mothur.git;a=blobdiff_plain;f=sffinfocommand.h;h=b304e485c1270aba1b4b761dc9e7b66af54dcfcf;hp=7cf357e07499ad5797dec8bbc1e647c163993aa8;hb=fefd5ee1517abd3bc38b469cb2dffc85a1571c7e;hpb=8bc3e5b38c2317a1715f53be22fa96455868c281 diff --git a/sffinfocommand.h b/sffinfocommand.h index 7cf357e..b304e48 100644 --- a/sffinfocommand.h +++ b/sffinfocommand.h @@ -11,49 +11,10 @@ */ #include "command.hpp" +#include "groupmap.h" +#include "oligos.h" +#include "trimoligos.h" - -/**********************************************************/ -struct CommonHeader { - unsigned int magicNumber; - string version; - unsigned long int 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 - - 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 { @@ -61,25 +22,40 @@ class SffInfoCommand : public Command { public: SffInfoCommand(string); SffInfoCommand(); - ~SffInfoCommand(); - vector getRequiredParameters(); - vector getValidParameters(); - vector getRequiredFiles(); - map > getOutputFiles() { return outputTypes; } - int execute(); - void help(); + ~SffInfoCommand(){} + + 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"; } + + int execute(); + void help() { m->mothurOut(getHelpString()); } private: - string sffFilename, outputDir, accnosName; - vector filenames, outputNames, accnosFileNames; - bool abort, fasta, qual, trim, flow, sfftxt, hasAccnos; + 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, reorient, pairedOligos; + int mycount, split, numBarcodes, numFPrimers, numLinkers, numSpacers, numRPrimers, pdiffs, bdiffs, ldiffs, sdiffs, tdiffs, numNoMatch; set seqNames; - map > outputTypes; - - int extractSffInfo(string, string); + GroupMap* groupMap; + vector > numSplitReads; + vector > filehandles; + vector > filehandlesHeaders; + Oligos* oligosObject; + + //extract sff file functions + 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&, TrimOligos*&, TrimOligos*&); + int decodeName(string&, string&, string&, string); + bool readOligos(string oligosFile); + bool readGroup(string oligosFile); int printCommonHeader(ofstream&, CommonHeader&); int printHeader(ofstream&, Header&); @@ -88,7 +64,18 @@ private: int printFastaSeqData(ofstream&, seqRead&, Header&); int printQualSeqData(ofstream&, seqRead&, Header&); int readAccnosFile(string); - + int parseSffTxt(); + bool sanityCheck(Header&, seqRead&); + int adjustCommonHeader(CommonHeader); + int findGroup(Header header, seqRead read, int& barcode, int& primer, TrimOligos*&, TrimOligos*&); + int findGroup(Header header, seqRead read, int& barcode, int& primer, string); + string reverseOligo(string oligo); + + //parsesfftxt file functions + int parseHeaderLineToInt(ifstream&); + vector parseHeaderLineToFloatVector(ifstream&, int); + vector parseHeaderLineToIntVector(ifstream&, int); + string parseHeaderLineToString(ifstream&); }; /**********************************************************/