Mercurial > repos > chrisd > testing
comparison gene_fraction/src/Alignments.h @ 0:f95150c37d38 draft default tip
planemo upload for repository https://github.com/ChrisD11/Tools commit ddc95e5d6b5f2c0a5340c0bc384aa822db8856d5
author | chrisd |
---|---|
date | Sun, 21 Feb 2016 23:31:55 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f95150c37d38 |
---|---|
1 #ifndef ALIGNMENTS_H | |
2 #define ALIGNMENTS_H | |
3 | |
4 #include <string> | |
5 #include <vector> | |
6 | |
7 /** | |
8 * Stores information about an alignment | |
9 */ | |
10 struct alignment_fields { | |
11 std::string QNAME; | |
12 int FLAG; | |
13 std::string RNAME; | |
14 int POS; | |
15 int MAPQ; | |
16 std::string CIGAR; | |
17 std::string RNEXT; | |
18 int PNEXT; | |
19 int TLEN; | |
20 std::string SEQ; | |
21 std::string QUAL; | |
22 }; | |
23 | |
24 /** | |
25 * Class for dealing with alignments | |
26 */ | |
27 class Alignments { | |
28 public: | |
29 /** | |
30 * Ctor that initializes alignment | |
31 */ | |
32 Alignments(std::string alignment); | |
33 | |
34 /** | |
35 * Stores information about each of the eleven | |
36 * required alignment fields | |
37 */ | |
38 void fill_alignment_fields(const std::string &alignment); | |
39 | |
40 std::vector<std::pair<int,char>> cigar(); | |
41 | |
42 inline std::string alignment() const { return _alignment; }; | |
43 | |
44 inline std::string qname() const { return field.QNAME; }; | |
45 inline std::string rname() const { return field.RNAME; }; | |
46 inline std::string cigar() const { return field.CIGAR; }; | |
47 inline std::string rnext() const { return field.RNEXT; }; | |
48 inline std::string seq() const { return field.SEQ; }; | |
49 inline std::string qual() const { return field.QUAL; }; | |
50 | |
51 inline int flag() const { return field.FLAG; }; | |
52 inline int pos() const { return field.POS; }; | |
53 inline int mapq() const { return field.MAPQ; }; | |
54 inline int pnext() const { return field.PNEXT; }; | |
55 inline int tlen() const { return field.TLEN; }; | |
56 | |
57 private: | |
58 /** | |
59 * Returns a pair of cigar operations as (occurrence, operation) | |
60 * Ex: 10M5I -> (10, M), (5, I) | |
61 */ | |
62 std::vector<std::pair<int,char>> get_cigar_operations(const std::string &cigar); | |
63 | |
64 std::string _alignment; | |
65 alignment_fields field; | |
66 }; | |
67 | |
68 #endif /* ALIGNMENTS_H */ |