]> git.donarmstrong.com Git - mothur.git/blob - sequence.hpp
added create.database command. fixed help in get.sharedseqs. added new constructor...
[mothur.git] / sequence.hpp
1 #ifndef SEQUENCE_H
2 #define SEQUENCE_H
3
4 /*
5  *  sequence.h
6  *  
7  *
8  *  Created by Pat Schloss on 12/15/08.
9  *  Copyright 2008 Patrick D. Schloss. All rights reserved.
10  *
11  *      A sequence object has three components: i) an accession number / name, ii) the unaligned primary sequence, iii) a
12  *      pairwise aligned sequence, and iv) a sequence that is aligned to a reference alignment.  This class has methods
13  *      to set and get these values for the other classes where they are needed.  *
14  *
15  */
16
17
18 //Data Structure for a fasta file.
19
20 #include "mothur.h"
21 #include "mothurout.h"
22
23 /**************************************************************************************************/
24
25 class Sequence {
26 public:
27         Sequence();
28         Sequence(string, string);
29         Sequence(ifstream&);
30     Sequence(ifstream&, string&, bool);
31         Sequence(istringstream&);
32         //these constructors just set the unaligned string to save space
33         Sequence(string, string, string);  
34         Sequence(ifstream&, string);
35         Sequence(istringstream&, string);
36         
37         void setName(string);
38         void setUnaligned(string);
39         void setPairwise(string);
40         void setAligned(string);
41         void setLength();
42         void reverseComplement();
43         void trim(int);
44         
45         string convert2ints();
46         string getName();
47         string getAligned();
48         string getPairwise();
49         string getUnaligned();
50         string getInlineSeq();
51         int getNumBases();
52         int getStartPos();
53         int getEndPos();
54         void padToPos(int);
55         void padFromPos(int);
56     int filterToPos(int); //any character before the pos is changed to . and aligned and unaligned strings changed
57     int filterFromPos(int); //any character after the pos is changed to . and aligned and unaligned strings changed
58         int getAlignLength();
59         int getAmbigBases();
60         void removeAmbigBases();
61         int getLongHomoPolymer();
62         bool getIsAligned();
63         void printSequence(ostream&);
64         
65 private:
66         MothurOut* m;
67         void initialize();
68         string getSequenceString(ifstream&, int&);
69         string getCommentString(ifstream&);
70         string getSequenceString(istringstream&, int&);
71         string getCommentString(istringstream&);
72         string name;
73         string unaligned;
74         string aligned;
75         string pairwise;
76         int numBases;
77         int alignmentLength;
78         bool isAligned;
79         int longHomoPolymer;
80         int ambigBases;
81         int startPos, endPos;
82 };
83
84 /**************************************************************************************************/
85
86 #endif