File: SAMAlignment.hpp

package info (click to toggle)
pbseqlib 5.3.1%2Bdfsg-2.1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 7,136 kB
  • sloc: cpp: 77,246; python: 570; makefile: 312; sh: 111; ansic: 9
file content (100 lines) | stat: -rw-r--r-- 2,342 bytes parent folder | download | duplicates (5)
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#ifndef _BLASR_SAM_ALIGNMENT_HPP_
#define _BLASR_SAM_ALIGNMENT_HPP_

#include <sstream>
#include <string>

#include <pbdata/sam/CigarString.h>
#include <pbdata/sam/SAMKeywordValuePair.hpp>

class SAMAlignment
{
public:
    enum SAMAlignmentRequiredFields
    {
        S_QNAME,
        S_FLAG,
        S_RNAME,
        S_POS,
        S_MAPQV,
        S_CIGAR,
        S_RNEXT,
        S_PNEXT,
        S_TLEN,
        S_SEQ,
        S_QUAL
    };

    static const char* SAMAlignmentRequiredFieldNames[];

    std::string qName;
    unsigned int flag;
    std::string rName;
    unsigned int pos;
    short mapQV;
    CigarString cigar;
    std::string rNext;
    int pNext;
    int tLen;
    std::string seq;
    std::string qual;

    // Optional tags defined in blasr:
    // "RG" read group Id
    // "AS" alignment score
    // "XS" read alignment start position without counting previous soft clips (1 based)
    // "XE" read alignment end position without counting previous soft clips (1 based)
    // "XL" aligned read length
    // "XQ" query read length
    // "XT" # of continues reads, always 1 for blasr
    // "NM" # of subreads
    // "FI" read alignment start position (1 based)
    //
    float score;
    int xs, xe;
    int xl;
    int xq;

    std::string rg;
    int as;
    int xt;
    int nm;
    int fi;
    std::string optTagStr;
    //
    // Quality values.
    //
    std::string iq, dq, sq, mq, st, dt;
    static const char* optionalQVTags[];
    static const char* optionalQVNames[];

    //
    // Initialize all optional fields.  Required fields will be
    // assigned a value later.
    //
    SAMAlignment();

    void PrintSAMAlignment(std::ostream& out = std::cout);

    // Find position of the nth character in a string.
    size_t FindPosOfNthChar(std::string str, int n, char c);

    // Trim the end '\n\r' characters from a string.
    std::string TrimStringEnd(std::string str);

    bool StoreValues(std::string& line, int lineNumber = 0);

    // CopyQVs writes the strings from the optional QV tags to a vector. The
    // order of QVs in the vector is given by optionalQVNames[]
    void CopyQVs(std::vector<std::string>* optionalQVs);
};

class SAMPosAlignment : public SAMAlignment
{
public:
    unsigned int qStart, qEnd;
    unsigned int tStart, tEnd;
    int qStrand, tStrand;
};

#endif