]> git.donarmstrong.com Git - mothur.git/blob - sffinfocommand.h
12f0180db565edf8818455648eadcc19107ec5ab
[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 #include "groupmap.h"
15
16 /**********************************************************/
17
18 class SffInfoCommand : public Command {
19         
20 public:
21         SffInfoCommand(string);
22         SffInfoCommand();
23         ~SffInfoCommand(){}
24         
25         vector<string> setParameters();
26         string getCommandName()                 { return "sffinfo";                                     }
27         string getCommandCategory()             { return "Sequence Processing";         }
28         
29         string getHelpString(); 
30     string getOutputPattern(string);    
31         string getCitation() { return "http://www.mothur.org/wiki/Sffinfo"; }
32         string getDescription()         { return "extract sequences reads from a .sff file"; }
33
34         int execute(); 
35         void help() { m->mothurOut(getHelpString()); }  
36         
37 private:
38         string sffFilename, sfftxtFilename, outputDir, accnosName, currentFileName, oligosfile, noMatchFile, groupfile;
39         vector<string> filenames, outputNames, accnosFileNames, oligosFileNames, groupFileNames;
40         bool abort, fasta, qual, trim, flow, sfftxt, hasAccnos, hasOligos, hasGroup;
41         int mycount, split, numFPrimers, numLinkers, numSpacers, pdiffs, bdiffs, ldiffs, sdiffs, tdiffs, numNoMatch;
42         set<string> seqNames;
43     map<string, int> barcodes;
44     map<string, int> primers;
45     GroupMap* groupMap;
46     vector<string> linker, spacer, primerNameVector, barcodeNameVector, revPrimer;
47     vector<vector<int> > numSplitReads;
48     vector<vector<string> > filehandles;
49     vector<vector<string> > filehandlesHeaders;
50     
51         //extract sff file functions
52         int extractSffInfo(string, string, string);
53         int readCommonHeader(ifstream&, CommonHeader&);
54         int readHeader(ifstream&, Header&);
55         bool readSeqData(ifstream&, seqRead&, int, Header&);
56         int decodeName(string&, string&, string&, string);
57     bool readOligos(string oligosFile);
58     bool readGroup(string oligosFile);
59         
60         int printCommonHeader(ofstream&, CommonHeader&); 
61         int printHeader(ofstream&, Header&);
62         int printSffTxtSeqData(ofstream&, seqRead&, Header&);
63         int printFlowSeqData(ofstream&, seqRead&, Header&);
64         int printFastaSeqData(ofstream&, seqRead&, Header&);
65         int printQualSeqData(ofstream&, seqRead&, Header&);
66         int readAccnosFile(string);
67         int parseSffTxt();
68         bool sanityCheck(Header&, seqRead&);
69     int adjustCommonHeader(CommonHeader);
70     int findGroup(Header header, seqRead read, int& barcode, int& primer);
71     int findGroup(Header header, seqRead read, int& barcode, int& primer, string);
72     string reverseOligo(string oligo);
73     
74         //parsesfftxt file functions
75         int parseHeaderLineToInt(ifstream&);
76         vector<unsigned short> parseHeaderLineToFloatVector(ifstream&, int);
77         vector<unsigned int> parseHeaderLineToIntVector(ifstream&, int);
78         string parseHeaderLineToString(ifstream&);
79 };
80
81 /**********************************************************/
82  
83 #endif
84
85