]> git.donarmstrong.com Git - mothur.git/blob - sequence.hpp
minor changes to pcr.seqs. Added filterToPos and filterFromPos to sequence class...
[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(istringstream&);
31         //these constructors just set the unaligned string to save space
32         Sequence(string, string, string);  
33         Sequence(ifstream&, string);
34         Sequence(istringstream&, string);
35         
36         void setName(string);
37         void setUnaligned(string);
38         void setPairwise(string);
39         void setAligned(string);
40         void setLength();
41         void reverseComplement();
42         void trim(int);
43         
44         string convert2ints();
45         string getName();
46         string getAligned();
47         string getPairwise();
48         string getUnaligned();
49         string getInlineSeq();
50         int getNumBases();
51         int getStartPos();
52         int getEndPos();
53         void padToPos(int);
54         void padFromPos(int);
55     int filterToPos(int); //any character before the pos is changed to . and aligned and unaligned strings changed
56     int filterFromPos(int); //any character after the pos is changed to . and aligned and unaligned strings changed
57         int getAlignLength();
58         int getAmbigBases();
59         void removeAmbigBases();
60         int getLongHomoPolymer();
61         bool getIsAligned();
62         void printSequence(ostream&);
63         
64 private:
65         MothurOut* m;
66         void initialize();
67         string getSequenceString(ifstream&, int&);
68         string getCommentString(ifstream&);
69         string getSequenceString(istringstream&, int&);
70         string getCommentString(istringstream&);
71         string name;
72         string unaligned;
73         string aligned;
74         string pairwise;
75         int numBases;
76         int alignmentLength;
77         bool isAligned;
78         int longHomoPolymer;
79         int ambigBases;
80         int startPos, endPos;
81 };
82
83 /**************************************************************************************************/
84
85 #endif