]> git.donarmstrong.com Git - mothur.git/blob - sequence.hpp
added count.groups command and paralellized align.seqs for windows
[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 #include "mothur.h"
18 #include "mothurout.h"
19
20 /**************************************************************************************************/
21
22 class Sequence {
23 public:
24         Sequence();
25         Sequence(string, string);
26         Sequence(ifstream&);
27         Sequence(istringstream&);
28         Sequence(const Sequence& se) : name(se.name), unaligned(se.unaligned), aligned(se.aligned), pairwise(se.pairwise), numBases(se.numBases), startPos(se.startPos), endPos(se.endPos),
29                                                                         alignmentLength(se.alignmentLength), isAligned(se.isAligned), longHomoPolymer(se.longHomoPolymer), ambigBases(se.ambigBases) { m = MothurOut::getInstance(); }
30         
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 getAlignLength();
56         int getAmbigBases();
57         void removeAmbigBases();
58         int getLongHomoPolymer();
59         bool getIsAligned();
60         void printSequence(ostream&);
61         
62 private:
63         MothurOut* m;
64         void initialize();
65         string getSequenceString(ifstream&);
66         string getCommentString(ifstream&);
67         string getSequenceString(istringstream&);
68         string getCommentString(istringstream&);
69         string name;
70         string unaligned;
71         string aligned;
72         string pairwise;
73         int numBases;
74         int alignmentLength;
75         bool isAligned;
76         int longHomoPolymer;
77         int ambigBases;
78         int startPos, endPos;
79 };
80
81 /**************************************************************************************************/
82
83 #endif