Mercurial > repos > chrisd > testshed
comparison snp_caller/src/Alignment.h @ 0:0fd352f62446 draft default tip
planemo upload for repository https://github.com/ChrisD11/Duplicon commit 3ee0594c692faac542ffa58f4339d79b9b8aefbd-dirty
author | chrisd |
---|---|
date | Sun, 21 Feb 2016 06:05:24 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:0fd352f62446 |
---|---|
1 #ifndef ALIGNMENT_H | |
2 #define ALIGNMENT_H | |
3 | |
4 #include <string> | |
5 #include <vector> | |
6 #include <algorithm> | |
7 | |
8 struct bit_flag { | |
9 /* SAM flags in English */ | |
10 bool read_paired = false; | |
11 bool read_mapped_in_proper_pair = false; | |
12 bool read_unmapped = false; | |
13 bool mate_unmapped = false; | |
14 bool read_reverse_strand = false; | |
15 bool mate_reverse_strand = false; | |
16 bool first_in_pair = false; | |
17 bool second_in_pair = false; | |
18 }; | |
19 | |
20 struct alignment_fields { | |
21 std::string QNAME; | |
22 int FLAG; | |
23 std::string RNAME; | |
24 int POS; | |
25 std::string MAPQ; | |
26 std::string CIGAR; | |
27 std::string RNEXT; | |
28 int PNEXT; | |
29 int TLEN; | |
30 std::string SEQ; | |
31 std::string QUAL; | |
32 }; | |
33 | |
34 class Alignment { | |
35 public: | |
36 Alignment(std::string alignment); | |
37 void fill_alignment_fields(const std::string &alignment); | |
38 void fill_bit_flag(const int &flag); | |
39 bool fill_xa_field(const std::string &alignment); | |
40 std::vector<std::pair<int,char> > get_cigar(); | |
41 | |
42 inline std::string alignment() const { return _alignment; }; | |
43 inline std::string qname() const { return field.QNAME; }; | |
44 inline std::string rname() const { return field.RNAME; }; | |
45 inline std::string mapq() const { return field.MAPQ; }; | |
46 inline std::string cigar() const { return field.CIGAR; }; | |
47 inline std::string seq() const { return field.SEQ; }; | |
48 inline std::string rnext() const { return field.RNEXT; }; | |
49 inline int flag() const { return field.FLAG; }; | |
50 inline int pos() const { return field.POS; }; | |
51 inline int pnext() const { return field.PNEXT; }; | |
52 inline int tlen() const { return field.TLEN; }; | |
53 | |
54 inline bool read_paired() const { return b_flag.read_paired; }; | |
55 inline bool read_mapped_in_proper_pair() const { return b_flag.read_mapped_in_proper_pair; }; | |
56 inline bool read_unmapped() const { return b_flag.read_unmapped; }; | |
57 inline bool mate_unmapped() const { return b_flag.mate_unmapped; }; | |
58 inline bool read_reverse_strand() const { return b_flag.read_reverse_strand; } | |
59 inline bool mate_reverse_strand() const { return b_flag.mate_reverse_strand; }; | |
60 inline bool first_in_pair() const { return b_flag.first_in_pair; }; | |
61 inline bool second_in_pair() const { return b_flag.second_in_pair; }; | |
62 | |
63 inline void set_rname(std::string rname) { | |
64 field.RNAME = rname; | |
65 } | |
66 inline void set_cigar(std::string cigar) { | |
67 field.CIGAR = cigar; | |
68 } | |
69 inline void set_pos(int pos) { | |
70 field.POS = pos; | |
71 } | |
72 | |
73 struct xa_fields { | |
74 std::string rname; | |
75 std::string cigar; | |
76 int pos; | |
77 int edit; | |
78 }; | |
79 | |
80 std::vector<xa_fields> alternate_hits; | |
81 private: | |
82 std::vector<std::pair<int,char> > get_cigar_operations(const std::string &cigar); | |
83 | |
84 std::string _alignment; | |
85 | |
86 alignment_fields field; | |
87 | |
88 bit_flag b_flag; | |
89 }; | |
90 | |
91 #endif // ALIGNMENT_H |