]> git.donarmstrong.com Git - mothur.git/blob - sffinfocommand.h
added pipeline commands which involved change to command factory and command class...
[mothur.git] / sffinfocommand.h
1 #ifndef SFFINFOCOMMAND_H
2 #define SFFINFOCOMMAND_H
3
4 /*
5  *  sffinfocommand.h
6  *  Mothur
7  *
8  *  Created by westcott on 7/7/10.
9  *  Copyright 2010 Schloss Lab. All rights reserved.
10  *
11  */
12
13 #include "command.hpp"
14
15
16 /**********************************************************/
17 struct CommonHeader {
18         unsigned int magicNumber;
19         string version;
20         unsigned long int 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
29         
30         CommonHeader(){ magicNumber=0; indexOffset=0; indexLength=0; numReads=0; headerLength=0; keyLength=0; numFlowsPerRead=0; flogramFormatCode='s'; } 
31         ~CommonHeader() { }
32 };
33 /**********************************************************/
34 struct Header {
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
43         
44         Header() { headerLength=0; nameLength=0; numBases=0; clipQualLeft=0; clipQualRight=0; clipAdapterLeft=0; clipAdapterRight=0; }
45         ~Header() { } 
46 };
47 /**********************************************************/
48 struct seqRead {
49         vector<unsigned short> flowgram;
50         vector<unsigned int> flowIndex;
51         string bases;
52         vector<unsigned int> qualScores;
53         
54         seqRead() { } 
55         ~seqRead() { } 
56 };
57 /**********************************************************/
58
59 class SffInfoCommand : public Command {
60         
61 public:
62         SffInfoCommand(string);
63         SffInfoCommand();
64         ~SffInfoCommand();
65         vector<string> getRequiredParameters();
66         vector<string> getValidParameters();
67         vector<string> getRequiredFiles();
68         map<string, vector<string> > getOutputFiles() { return outputTypes; }
69         int execute();
70         void help();
71         
72 private:
73         string sffFilename, outputDir, accnosName;
74         vector<string> filenames, outputNames, accnosFileNames;
75         bool abort, fasta, qual, trim, flow, sfftxt, hasAccnos;
76         set<string> seqNames;
77         map<string, vector<string> > outputTypes;
78         
79         int extractSffInfo(string, string);
80         int readCommonHeader(ifstream&, CommonHeader&);
81         int readHeader(ifstream&, Header&);
82         int readSeqData(ifstream&, seqRead&, int, int);
83         
84         int printCommonHeader(ofstream&, CommonHeader&); 
85         int printHeader(ofstream&, Header&);
86         int printSffTxtSeqData(ofstream&, seqRead&, Header&);
87         int printFlowSeqData(ofstream&, seqRead&, Header&);
88         int printFastaSeqData(ofstream&, seqRead&, Header&);
89         int printQualSeqData(ofstream&, seqRead&, Header&);
90         int readAccnosFile(string);
91                 
92 };
93
94 /**********************************************************/
95  
96 #endif
97
98