File: seq.h

package info (click to toggle)
muscle 3.60-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,384 kB
  • ctags: 2,079
  • sloc: cpp: 26,452; xml: 185; makefile: 101
file content (85 lines) | stat: -rw-r--r-- 1,868 bytes parent folder | download | duplicates (14)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#ifndef Seq_h
#define Seq_h

#include <vector>

class TextFile;
class MSA;

typedef std::vector<char> CharVect;

class Seq : public CharVect
	{
public:
	Seq()
		{
		m_ptrName = 0;
	// Start with moderate size to avoid
	// thrashing the heap.
		reserve(200);
		}
	virtual ~Seq()
		{
		delete[] m_ptrName;
		}

private:
// Not implemented; prevent use of copy c'tor and assignment.
	Seq(const Seq &);
	Seq &operator=(const Seq &);

public:
	void Clear()
		{
		clear();
		delete[] m_ptrName;
		m_ptrName = 0;
		m_uId = uInsane;
		}
	const char *GetName() const
		{
		return m_ptrName;
		}
	unsigned GetId() const
		{
		if (uInsane == m_uId)
			Quit("Seq::GetId, id not set");
		return m_uId;
		}
	void SetId(unsigned uId) { m_uId = uId; }

	bool FromFASTAFile(TextFile &File);
	void ToFASTAFile(TextFile &File) const;
	void ExtractUngapped(MSA &msa) const;

	void FromString(const char *pstrSeq, const char *pstrName);
	void Copy(const Seq &rhs);
	void CopyReversed(const Seq &rhs);
	void StripGaps();
	void StripGapsAndWhitespace();
	void ToUpper();
	void SetName(const char *ptrName);
	unsigned GetLetter(unsigned uIndex) const;
	unsigned Length() const { return (unsigned) size(); }
	bool Eq(const Seq &s) const;
	bool EqIgnoreCase(const Seq &s) const;
	bool EqIgnoreCaseAndGaps(const Seq &s) const;
	bool HasGap() const;
	unsigned GetUngappedLength() const;
	void LogMe() const;
	char GetChar(unsigned uIndex) const { return operator[](uIndex); }
	void SetChar(unsigned uIndex, char c) { operator[](uIndex) = c; }
	void AppendChar(char c) { push_back(c); }
	void FixAlpha();

#ifndef	_WIN32
	reference at(size_type i) { return operator[](i); }
	const_reference at(size_type i) const { return operator[](i); }
#endif

private:
	char *m_ptrName;
	unsigned m_uId;
	};

#endif	// Seq.h