File: AfgBasWriter.hpp

package info (click to toggle)
pbseqlib 5.3.5%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 7,020 kB
  • sloc: cpp: 77,250; python: 331; sh: 103; makefile: 41
file content (58 lines) | stat: -rw-r--r-- 1,341 bytes parent folder | download | duplicates (4)
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
#ifndef _BLASR_AMOS_AFG_BAS_WRITER_HPP_
#define _BLASR_AMOS_AFG_BAS_WRITER_HPP_

#include <cmath>
#include <fstream>
#include <sstream>

#include <pbdata/SMRTSequence.hpp>

class AfgBasWriter
{
    // TODO correct file type? outFile
    // TODO change SMRTSequence to FASTQ sequence? then maybe fasta2afg would be
    // easier to write
    std::string afgFileName;
    std::ofstream afgOut;
    bool firstRecord;
    int recordCount;
    int defaultQuality;
    // Use 122 = '{' - 1 because '{' and '}' are the message delimiters in AMOS.
    static const unsigned char maxAfgQuality = 122;
    static const unsigned char charToQuality = 48;
    static const unsigned char minAfgQuality = charToQuality + 1;
    static const int lineLength = 80;

private:
    unsigned char pacbioQVtoPhredQV(unsigned char pacbio);

public:
    // Assume that closing the afg file must be done
    // manually and not in a destructor.
    ~AfgBasWriter();

    AfgBasWriter();

    void Initialize(std::string _afgFileName);

    void Close();

    int Write(SMRTSequence &seq);

    void SetDefaultQuality(int _defaultQuality);

private:
    void WriteHeader();

    void WriteOpen(void);

    void WriteIdentifier(SMRTSequence &seq);

    void WriteClose();

    void WriteBases(SMRTSequence &seq);

    void WriteQualities(SMRTSequence &seq);
};

#endif