File: fasta.h

package info (click to toggle)
assembly-stats 1.0.1%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 256 kB
  • sloc: cpp: 795; sh: 31; makefile: 9
file content (51 lines) | stat: -rw-r--r-- 1,254 bytes parent folder | download | duplicates (2)
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
#ifndef FASTA_H
#define FASTA_H

#include <iostream>
#include <string>
#include <fstream>
#include <map>
#include <algorithm>
#include <vector>


using namespace std;

class Fasta
{
public:
    Fasta();
    Fasta(string id, string seq);
    virtual ~Fasta(){}

    string name() const;
    string seq() const;
    virtual string qual() const; // returns "".  Here for compatibility with Fastq

    void name(string s);
    void seq(string s);
    virtual void setQual(string s); // does nothing, here for compatibility with Fastq

    // returns number of bases in sequence
    unsigned long length() const;

    // returns number of Ns (case insensitive)
    unsigned long nCount() const;

    // Return vector with (start, end) positions of each gap in the sequence.
    // Coords zero-based
    vector< pair<unsigned long, unsigned long> > gaps() const;

    // prints the sequence. If lineWidth=0 then no linbreaks in output
    virtual void toString(ostream& outStream, unsigned int lineWidth=60) const;

    // reads next sequence from file, filling contents appropriately
    // Returns true if worked ok, false if at end of file
    virtual bool fillFromFile(istream& inStream);

protected:
    string id_;
    string seq_;
};

#endif // FASTA_H