10 using namespace std;
\r
15 SeqDB(const SeqDB &rhs);
\r
16 SeqDB &operator=(const SeqDB &rhs);
\r
22 unsigned *m_SeqLengths;
\r
23 unsigned m_SeqCount;
\r
33 void Clear(bool ctor = false);
\r
34 void InitEmpty(bool Nucleo);
\r
36 unsigned AddSeq(const char *Label, const byte *Seq, unsigned L);
\r
38 byte *GetSeq(unsigned SeqIndex) const
\r
40 asserta(SeqIndex < m_SeqCount);
\r
41 return m_Seqs[SeqIndex];
\r
44 const char *GetLabel(unsigned SeqIndex) const
\r
46 asserta(SeqIndex < m_SeqCount);
\r
47 return m_Labels[SeqIndex];
\r
50 unsigned GetSeqLength(unsigned SeqIndex) const
\r
52 asserta(SeqIndex < m_SeqCount);
\r
53 return m_SeqLengths[SeqIndex];
\r
56 unsigned GetSeqCount() const
\r
61 unsigned GetPairCount() const
\r
63 unsigned SeqCount = GetSeqCount();
\r
64 return (SeqCount*(SeqCount - 1))/2;
\r
67 unsigned GetPairIndex(unsigned SeqIndex1, unsigned SeqIndex2) const
\r
69 if (SeqIndex1 > SeqIndex2)
\r
70 return (SeqIndex1*(SeqIndex1 - 1))/2 + SeqIndex2;
\r
71 return (SeqIndex2*(SeqIndex2 - 1))/2 + SeqIndex1;
\r
74 unsigned GetColCount() const
\r
77 Die("SeqDB::GetColCount, not aligned");
\r
78 if (m_SeqCount == 0)
\r
79 Die("SeqDB::GetColCount, empty");
\r
80 return m_SeqLengths[0];
\r
83 bool IsNucleo() const
\r
85 asserta(m_IsNucleoSet);
\r
89 void GetSeqData(unsigned Id, SeqData &Buffer) const;
\r
91 unsigned GetMaxLabelLength() const;
\r
92 unsigned GetMaxSeqLength() const;
\r
94 unsigned GetIndex(const char *Label) const;
\r
95 void MakeLabelToIndex(map<string, unsigned> &LabelToIndex);
\r
98 void FromFasta(const string &FileName, bool AllowGaps = false);
\r
100 void ToFasta(const string &FileName) const;
\r
101 void ToFasta(FILE *f, unsigned SeqIndex) const;
\r
102 void SeqToFasta(FILE *f, unsigned SeqIndex, bool WithLabel = false) const;
\r
104 unsigned GetTotalLength() const;
\r
107 bool isgap(byte c);
\r