A single alignment record from a SAM file. More...
#include <Sequence/samrecord.hpp>
Public Types | |
| typedef std::vector< std::pair < char, unsigned > >::const_iterator | cigar_iterator |
| typedef std::vector< samtag > ::const_iterator | tag_iterator |
Public Member Functions | |
| samrecord (const samrecord &r) | |
| samrecord (const std::string &s) | |
| std::string | qname () const |
| samflag | flag () const |
| std::string | rname () const |
| unsigned long | pos () const |
| unsigned long | mapq () const |
| std::string | cigar () const |
| std::string | mrnm () const |
| unsigned long | mpos () const |
| int | isize () const |
| std::string | seq () const |
| std::string | qual () const |
| std::string | tags () const |
| std::istream & | read (std::istream &i) |
| std::ostream & | print (std::ostream &o) const |
| cigar_iterator | cig_begin () const |
| cigar_iterator | cig_end () const |
| tag_iterator | tag_begin () const |
| tag_iterator | tag_end () const |
A single alignment record from a SAM file.
Intended usage: samtools view (b|s)amfile | ./program_using_this_class
In essence, this class stores a single line of mapping data as a string. This string is then parsed lazily. Here, lazy parsing means that iterators are stored to the beginning and end of each field, rather than storing each data field as a separate variable. This drastically speeds up the speed of reading in records because, in practice, only a subset of the fields may actually be desired.
When a particular field is wanted, the appropriate member function is called, and the iterators are used to construct the desired value.
Definition at line 69 of file samrecord.hpp.
| typedef std::vector< std::pair<char,unsigned> >::const_iterator Sequence::samrecord::cigar_iterator |
Iterator over elements of CIGAR string. The char is the field type, and the unsigned integer is the value. Thus, the follwing CIGAR string, 5M2P5M, may be accessed as follows:
Sequence::samrecord s; std::cin >> s; for( s::cigar_iterator ci = s.cig_begin() ; ci < s.cig_end() ; ++ci ) { std::cout << ci->first << '\t' << ci->second << '\n'; }
Will print to the screen:
M 5
P 2
M 5
Definition at line 98 of file samrecord.hpp.
| typedef std::vector< samtag >::const_iterator Sequence::samrecord::tag_iterator |
Iterator over elements of the optional TAG fields at the end of a SAM record.
Example usage:
Sequence::samrecord s; std::cin >> s; for( s::tag_iterator ti = s.tag_begin() ; ti < s.tag_end() ; ++ti ) { std::cout << ti->tag() << '\t' << ti->vtype() << '\t' << ti->value() << '\n'; }
Definition at line 112 of file samrecord.hpp.
| samrecord::cigar_iterator Sequence::samrecord::cig_begin | ( | ) | const |
Definition at line 207 of file samrecord.cc.
| samrecord::cigar_iterator Sequence::samrecord::cig_end | ( | ) | const |
Definition at line 215 of file samrecord.cc.
| std::string Sequence::samrecord::cigar | ( | ) | const |
Definition at line 281 of file samrecord.cc.
| samflag Sequence::samrecord::flag | ( | ) | const |
Definition at line 247 of file samrecord.cc.
| int Sequence::samrecord::isize | ( | ) | const |
Definition at line 305 of file samrecord.cc.
| unsigned long Sequence::samrecord::mapq | ( | ) | const |
Definition at line 272 of file samrecord.cc.
| unsigned long Sequence::samrecord::mpos | ( | ) | const |
Definition at line 297 of file samrecord.cc.
| std::string Sequence::samrecord::mrnm | ( | ) | const |
Definition at line 289 of file samrecord.cc.
| unsigned long Sequence::samrecord::pos | ( | ) | const |
Definition at line 263 of file samrecord.cc.
| std::ostream & Sequence::samrecord::print | ( | std::ostream & | o | ) | const |
called by operator<<
Definition at line 347 of file samrecord.cc.
| std::string Sequence::samrecord::qname | ( | ) | const |
Definition at line 239 of file samrecord.cc.
| std::string Sequence::samrecord::qual | ( | ) | const |
Definition at line 321 of file samrecord.cc.
| std::istream & Sequence::samrecord::read | ( | std::istream & | i | ) |
called by operator>>
Definition at line 337 of file samrecord.cc.
| std::string Sequence::samrecord::rname | ( | ) | const |
Definition at line 255 of file samrecord.cc.
| std::string Sequence::samrecord::seq | ( | ) | const |
Definition at line 313 of file samrecord.cc.
| samrecord::tag_iterator Sequence::samrecord::tag_begin | ( | ) | const |
Definition at line 223 of file samrecord.cc.
| samrecord::tag_iterator Sequence::samrecord::tag_end | ( | ) | const |
Definition at line 231 of file samrecord.cc.
| string Sequence::samrecord::tags | ( | ) | const |
Definition at line 329 of file samrecord.cc.
1.6.3