Mercurial > repos > chrisd > testing
comparison gene_fraction/src/Alignments.cpp @ 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 #include "Alignments.h" | |
2 #include "int_util.h" | |
3 | |
4 #include <boost/algorithm/string.hpp> | |
5 | |
6 #include <iostream> | |
7 #include <sstream> | |
8 | |
9 Alignments::Alignments(std::string alignment) : _alignment(alignment) { | |
10 fill_alignment_fields(alignment); | |
11 } | |
12 | |
13 void Alignments::fill_alignment_fields(const std::string &alignment) { | |
14 std::istringstream ss(alignment); | |
15 ss >> field.QNAME >> field.FLAG >> field.RNAME >> field.POS >> | |
16 field.MAPQ >> field.CIGAR >> field.RNEXT >> field.PNEXT >> | |
17 field.TLEN >> field.SEQ >> field.QUAL; | |
18 } | |
19 | |
20 std::vector<std::pair<int,char>> Alignments::cigar() { | |
21 return get_cigar_operations(field.CIGAR); | |
22 } | |
23 | |
24 std::vector<std::pair<int,char>> Alignments::get_cigar_operations(const std::string &cigar) { | |
25 std::vector<std::pair<int,char>> p; | |
26 int count; | |
27 char operation; | |
28 | |
29 std::istringstream ss(cigar); | |
30 while(ss >> count >> operation) { | |
31 p.push_back(std::make_pair(count, operation)); | |
32 } | |
33 | |
34 return p; | |
35 } |