1 #ifndef gamgee__sam__guard
2 #define gamgee__sam__guard
35 explicit Sam(
const std::shared_ptr<bam_hdr_t>&
header,
const std::shared_ptr<bam1_t>& body) noexcept;
57 Sam(
Sam&& other) =
default;
80 uint32_t
chromosome()
const {
return uint32_t(m_body->core.tid); }
316 bool empty()
const {
return m_body ==
nullptr; }
319 std::shared_ptr<bam_hdr_t> m_header;
320 std::shared_ptr<bam1_t> m_body;
uint32_t alignment_stop() const
returns a (1-based and inclusive) alignment stop position.
Definition: sam.h:94
int32_t insert_size() const
inferred insert size as reported by the aligner
Definition: sam.h:256
void set_first()
Definition: sam.h:303
uint32_t mate_unclipped_stop() const
returns a (1-based and inclusive) mate's unclipped alignment stop position.
Definition: sam.cpp:103
void set_not_paired()
Definition: sam.h:294
void set_not_first()
Definition: sam.h:304
void set_duplicate()
Definition: sam.h:311
uint32_t mate_unclipped_start() const
returns a (1-based and inclusive) mate's unclipped alignment start position.
Definition: sam.cpp:83
uint32_t alignment_start() const
the reference position of the first base in the read
Definition: sam.h:87
class to build Sam objects from existing data or from scratch
Definition: sam_builder.h:58
void set_reverse()
Definition: sam.h:299
BaseQuals base_quals() const
returns the base qualities.
Definition: sam.h:270
bool empty() const
whether or not this Sam object is empty, meaning that the internal memory has not been initialized (i...
Definition: sam.h:316
uint32_t mate_chromosome() const
returns the integer representation of the mate's chromosome.
Definition: sam.h:126
uint32_t chromosome() const
chromosome index of the read.
Definition: sam.h:80
void set_not_last()
Definition: sam.h:306
#define BAM_FPAIRED
Definition: sam.h:103
bool paired() const
whether or not this read is paired
Definition: sam.h:279
#define BAM_FREAD2
Definition: sam.h:117
SamHeader header()
the header of the Sam record
Definition: sam.h:69
int32_t bam_endpos(const bam1_t *b)
Definition: sam.c:261
void set_not_duplicate()
Definition: sam.h:312
#define BAM_FPROPER_PAIR
Definition: sam.h:105
bool last() const
whether or not this read is the last read in a pair (or multiple pairs)
Definition: sam.h:286
bool secondary() const
whether or not this read is a secondary alignment (see definition in BAM spec)
Definition: sam.h:287
void set_fail()
Definition: sam.h:309
void set_mapping_qual(const uint8_t mapq)
simple setter for the alignment quality
Definition: sam.h:263
bool fail() const
whether or not this read is marked as failing vendor (sequencer) quality control
Definition: sam.h:288
utility class to write out a SAM/BAM/CRAM file to any stream
Definition: sam_writer.h:20
bool mate_reverse() const
whether or not the mate read is from the reverse strand
Definition: sam.h:284
uint32_t unclipped_stop() const
calculates the theoretical alignment stop of a read that has soft/hard-clips preceding the alignment ...
Definition: sam.cpp:70
SamTag< std::string > string_tag(const std::string &tag_name) const
retrieve a string-valued tag by name.
Definition: sam.cpp:182
Sam & operator=(const Sam &other)
creates a deep copy of a sam record
Definition: sam.cpp:28
Utility class to handle the memory management of the sam record object for a read base qualities...
Definition: base_quals.h:13
SamTag< double > double_tag(const std::string &tag_name) const
retrieve an double/float-valued tag by name.
Definition: sam.cpp:151
bool first() const
whether or not this read is the first read in a pair (or multiple pairs)
Definition: sam.h:285
void set_mate_alignment_start(const uint32_t mstart)
simple setter for the mate's alignment start.
Definition: sam.h:262
uint32_t unclipped_start() const
calculates the theoretical alignment start of a read that has soft/hard-clips preceding the alignment...
Definition: sam.cpp:57
bool duplicate() const
whether or not this read is a duplicate
Definition: sam.h:289
bool unmapped() const
whether or not this read is unmapped
Definition: sam.h:281
void set_mate_unmapped()
Definition: sam.h:297
#define BAM_FMREVERSE
Definition: sam.h:113
uint32_t mate_alignment_stop() const
returns a (1-based and inclusive) mate's alignment stop position.
Definition: sam.cpp:50
bool properly_paired() const
whether or not this read is properly paired (see definition in BAM spec)
Definition: sam.h:280
#define BAM_FQCFAIL
Definition: sam.h:121
#define BAM_FSUPPLEMENTARY
Definition: sam.h:125
SamTag< int32_t > integer_tag(const std::string &tag_name) const
retrieve an integer-valued tag by name.
Definition: sam.cpp:137
uint8_t mapping_qual() const
returns the mapping quality of this alignment
Definition: sam.h:242
uint32_t mate_alignment_start() const
returns a (1-based and inclusive) mate's alignment start position (as you would see in a Sam file)...
Definition: sam.h:132
#define BAM_FSECONDARY
Definition: sam.h:119
void set_not_secondary()
Definition: sam.h:308
std::string name() const
returns the read name
Definition: sam.h:267
Definition: exceptions.h:9
#define BAM_FMUNMAP
Definition: sam.h:109
void set_mate_reverse()
Definition: sam.h:301
Sam()=default
initializes a null Sam.
void set_mate_chromosome(const uint32_t mchr)
simple setter for the mate's chromosome index. Index is 0-based.
Definition: sam.h:261
class to represent a Sam TAG:TYPE:VALUE entry
Definition: sam_tag.h:12
void set_not_unmapped()
Definition: sam.h:296
bool reverse() const
whether or not this read is from the reverse strand
Definition: sam.h:283
void set_alignment_start(const uint32_t start)
simple setter for the alignment start.
Definition: sam.h:260
#define BAM_FUNMAP
Definition: sam.h:107
void set_last()
Definition: sam.h:305
void set_supplementary()
Definition: sam.h:313
void set_not_reverse()
Definition: sam.h:300
Utility class to manipulate a Sam record.
Definition: sam.h:20
#define BAM_FREAD1
Definition: sam.h:115
void set_insert_size(const int32_t isize)
simple setter for the insert size
Definition: sam.h:264
void set_not_supplementary()
Definition: sam.h:314
Utility class to handle the memory management of the sam record object for read bases.
Definition: read_bases.h:26
void set_paired()
Definition: sam.h:293
SamTag< char > char_tag(const std::string &tag_name) const
retrieve a char-valued tag by name.
Definition: sam.cpp:165
#define BAM_FREVERSE
Definition: sam.h:111
bool mate_unmapped() const
whether or not the mate read is unmapped
Definition: sam.h:282
#define bam_get_qname(b)
Definition: sam.h:196
void set_chromosome(const uint32_t chr)
simple setter for the chromosome index. Index is 0-based.
Definition: sam.h:259
Utility class to manage the memory of the cigar structure.
Definition: cigar.h:24
void set_not_fail()
Definition: sam.h:310
void set_not_mate_reverse()
Definition: sam.h:302
ReadBases bases() const
returns the read bases.
Definition: sam.h:269
bool supplementary() const
whether or not this read is a supplementary alignment (see definition in the BAM spec) ...
Definition: sam.h:290
#define BAM_FDUP
Definition: sam.h:123
Cigar cigar() const
returns the cigar.
Definition: sam.h:268
void set_secondary()
Definition: sam.h:307
void set_unmapped()
Definition: sam.h:295
void set_not_mate_unmapped()
Definition: sam.h:298