]> git.donarmstrong.com Git - mothur.git/blob - sequenceparser.h
sffinfo bug with flow grams right index when clipQualRight=0
[mothur.git] / sequenceparser.h
1 #ifndef SEQUENCEPARSER_H
2 #define SEQUENCEPARSER_H
3
4 /*
5  *  sequenceParser.h
6  *  Mothur
7  *
8  *  Created by westcott on 9/9/11.
9  *  Copyright 2011 Schloss Lab. All rights reserved.
10  *
11  */
12
13
14 #include "mothur.h"
15 #include "mothurout.h"
16 #include "sequence.hpp"
17 #include "groupmap.h"
18
19 /* This class reads a fasta and group file with a namesfile as optional and parses the data by group. 
20  
21         Note: The sum of all the groups unique sequences will be larger than the original number of unique sequences. 
22         This is because when we parse the name file we make a unique for each group instead of 1 unique for all
23         groups. 
24  
25  */
26
27 class SequenceParser {
28         
29         public:
30         
31                 SequenceParser(string, string);                 //group, fasta - file mismatches will set m->control_pressed = true
32                 SequenceParser(string, string, string); //group, fasta, name  - file mismatches will set m->control_pressed = true
33                 ~SequenceParser();
34                 
35                 //general operations
36                 int getNumGroups();
37                 vector<string> getNamesOfGroups();      
38                 bool isValidGroup(string);  //return true if string is a valid group
39                 
40                 int getNumSeqs(string);         //returns the number of unique sequences in a specific group
41                 vector<Sequence> getSeqs(string); //returns unique sequences in a specific group
42                 map<string, string> getNameMap(string); //returns seqName -> namesOfRedundantSeqs separated by commas for a specific group - the name file format, but each line is parsed by group.
43                 
44                 int getSeqs(string, string, bool); //prints unique sequences in a specific group to a file - group, filename, uchimeFormat=false
45                 int getNameMap(string, string); //print seqName -> namesOfRedundantSeqs separated by commas for a specific group - group, filename
46                 
47                 map<string, string> getAllSeqsMap(){ return allSeqsMap; }  //returns map where the key=sequenceName and the value=representativeSequence - helps us remove duplicates after group by group processing
48         private:
49         
50                 GroupMap* groupMap;
51                 MothurOut* m;
52         
53                 int numSeqs;
54                 map<string, string> allSeqsMap;
55                 map<string, vector<Sequence> > seqs; //a vector for each group
56                 map<string, map<string, string> > nameMapPerGroup; //nameMap for each group
57 };
58
59 #endif
60