Mercurial > repos > chrisd > testshed
comparison gene_fraction/src/Alignments.cpp @ 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 #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 } |
