]> git.donarmstrong.com Git - mothur.git/blob - fastamap.h
changed random forest output filename
[mothur.git] / fastamap.h
1 #ifndef FASTAMAP_H
2 #define FASTAMAP_H
3
4 /*
5  *  fastamap.h
6  *  mothur
7  *
8  *  Created by Sarah Westcott on 1/16/09.
9  *  Copyright 2009 Schloss Lab UMASS AMherst. All rights reserved.
10  *
11  */
12  
13 #include "mothur.h"
14 #include "mothurout.h"
15
16
17 /* This class represents the fasta file.  It reads a fasta file a populates the internal data structure "data".
18 Data is a map where the key is the sequence and the value is a struct containing the sequences groupname, 
19 a list of the sequences names who have the same sequence and a number of how many sequence names there are. */
20
21
22 class FastaMap  {
23
24 public:
25         FastaMap() { m = MothurOut::getInstance(); }
26         ~FastaMap() {};
27         
28         string getGroupName(string);  //pass a sequence name get its group
29         string getNames(string);        //pass a sequence get the string of names in the group separated by ','s.
30         void push_back(string, string); //sequencename, sequence
31         int sizeUnique();                                       //returns number of unique sequences
32         void printNamesFile(string);            //produces a 2 column file with the groupname in the first column and the names in the second column - a names file.
33         void printCondensedFasta(string);               //produces a fasta file.
34         void readFastaFile(string);
35         void readFastaFile(string, string);
36         string getSequence(string);             //pass it a name of a sequence, it returns the sequence.
37
38 private:
39         struct group {
40                 string groupname;                                       //the group name for identical sequences, will be set to the first sequence found.
41                 string names;                                           //the names of the sequence separated by ','.
42         };
43
44         map<string, group>  data;  //sequence, groupinfo        - condensed representation of file
45         map<string, string>  seqmap;  //name, sequence  -  uncondensed representation of file
46         MothurOut* m;
47 };
48
49 #endif