1 #ifndef SFFINFOCOMMAND_H
2 #define SFFINFOCOMMAND_H
8 * Created by westcott on 7/7/10.
9 * Copyright 2010 Schloss Lab. All rights reserved.
13 #include "command.hpp"
16 /**********************************************************/
18 unsigned int magicNumber;
20 unsigned long long indexOffset;
21 unsigned int indexLength;
22 unsigned int numReads;
23 unsigned short headerLength;
24 unsigned short keyLength;
25 unsigned short numFlowsPerRead;
26 int flogramFormatCode;
27 string flowChars; //length depends on number flow reads
28 string keySequence; //length depends on key length
30 CommonHeader(){ magicNumber=0; indexOffset=0; indexLength=0; numReads=0; headerLength=0; keyLength=0; numFlowsPerRead=0; flogramFormatCode='s'; }
33 /**********************************************************/
35 unsigned short headerLength;
36 unsigned short nameLength;
37 unsigned int numBases;
38 unsigned short clipQualLeft;
39 unsigned short clipQualRight;
40 unsigned short clipAdapterLeft;
41 unsigned short clipAdapterRight;
42 string name; //length depends on nameLength
47 Header() { headerLength=0; nameLength=0; numBases=0; clipQualLeft=0; clipQualRight=0; clipAdapterLeft=0; clipAdapterRight=0; }
50 /**********************************************************/
52 vector<unsigned short> flowgram;
53 vector<unsigned int> flowIndex;
55 vector<unsigned int> qualScores;
60 /**********************************************************/
62 class SffInfoCommand : public Command {
65 SffInfoCommand(string);
69 vector<string> setParameters();
70 string getCommandName() { return "sffinfo"; }
71 string getCommandCategory() { return "Sequence Processing"; }
72 string getHelpString();
73 string getCitation() { return "http://www.mothur.org/wiki/Sffinfo"; }
74 string getDescription() { return "extract sequences reads from a .sff file"; }
77 void help() { m->mothurOut(getHelpString()); }
80 string sffFilename, sfftxtFilename, outputDir, accnosName;
81 vector<string> filenames, outputNames, accnosFileNames;
82 bool abort, fasta, qual, trim, flow, sfftxt, hasAccnos;
86 //extract sff file functions
87 int extractSffInfo(string, string);
88 int readCommonHeader(ifstream&, CommonHeader&);
89 int readHeader(ifstream&, Header&);
90 int readSeqData(ifstream&, seqRead&, int, int);
91 int decodeName(string&, string&, string&, string);
93 int printCommonHeader(ofstream&, CommonHeader&);
94 int printHeader(ofstream&, Header&);
95 int printSffTxtSeqData(ofstream&, seqRead&, Header&);
96 int printFlowSeqData(ofstream&, seqRead&, Header&);
97 int printFastaSeqData(ofstream&, seqRead&, Header&);
98 int printQualSeqData(ofstream&, seqRead&, Header&);
99 int readAccnosFile(string);
102 //parsesfftxt file functions
103 int parseHeaderLineToInt(ifstream&);
104 vector<unsigned short> parseHeaderLineToFloatVector(ifstream&, int);
105 vector<unsigned int> parseHeaderLineToIntVector(ifstream&, int);
106 string parseHeaderLineToString(ifstream&);
109 /**********************************************************/