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