]> git.donarmstrong.com Git - mothur.git/blob - sequence.hpp
changing command name classify.shared to classifyrf.shared
[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 getNumNs();
52         int getNumBases();
53         int getStartPos();
54         int getEndPos();
55         void padToPos(int);
56         void padFromPos(int);
57     int filterToPos(int); //any character before the pos is changed to . and aligned and unaligned strings changed
58     int filterFromPos(int); //any character after the pos is changed to . and aligned and unaligned strings changed
59         int getAlignLength();
60         int getAmbigBases();
61         void removeAmbigBases();
62         int getLongHomoPolymer();
63         bool getIsAligned();
64         void printSequence(ostream&);
65         
66 private:
67         MothurOut* m;
68         void initialize();
69         string getSequenceString(ifstream&, int&);
70         string getCommentString(ifstream&);
71         string getSequenceString(istringstream&, int&);
72         string getCommentString(istringstream&);
73     string getSequenceName(ifstream&);
74     string getSequenceName(istringstream&);
75         string name;
76         string unaligned;
77         string aligned;
78         string pairwise;
79         int numBases;
80         int alignmentLength;
81         bool isAligned;
82         int longHomoPolymer;
83         int ambigBases;
84         int startPos, endPos;
85 };
86
87 /**************************************************************************************************/
88
89 #endif