Gamgee
You miserable little maggot. I'll stove your head in!
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Friends | List of all members
gamgee::SamHeader Class Reference

Utility class to hold the header of a sam file. More...

#include <sam_header.h>

Public Member Functions

 SamHeader ()=default
 initializes a null SamHeader More...
 
 SamHeader (const std::shared_ptr< bam_hdr_t > &header)
 creates a SamHeader given htslib object. More...
 
 SamHeader (const SamHeader &other)
 makes a deep copy of a SamHeader. Shared pointers maintain state to all other associated objects correctly. More...
 
SamHeaderoperator= (const SamHeader &other)
 deep copy assignment of a SamHeader. Shared pointers maintain state to all other associated objects correctly. More...
 
 SamHeader (SamHeader &&other)=default
 moves SamHeader accordingly. Shared pointers maintain state to all other associated objects correctly. More...
 
SamHeaderoperator= (SamHeader &&other)=default
 move assignment of a SamHeader. Shared pointers maintain state to all other associated objects correctly. More...
 
uint32_t n_sequences () const
 Returns the number of reference sequences in the header. More...
 
uint32_t sequence_length (const std::string &sequence_name) const
 Returns the length of the given reference sequence as stored in the @SQ tag in the BAM header. More...
 
uint32_t sequence_length (const uint32_t sequence_index) const
 Returns the length of the given reference sequence as stored in the @SQ tag in the BAM header. More...
 
std::string sequence_name (const uint32_t sequence_index) const
 Returns the sequence name for the sequence with the given zero-based index. More...
 
std::vector< ReadGroupread_groups () const
 extracts read group objects from a SAM header More...
 

Friends

class SamWriter
 
class SamBuilder
 

Detailed Description

Utility class to hold the header of a sam file.

Constructor & Destructor Documentation

gamgee::SamHeader::SamHeader ( )
explicitdefault

initializes a null SamHeader

Warning
if you need to create a SamHeader from scratch, use the builder instead
gamgee::SamHeader::SamHeader ( const std::shared_ptr< bam_hdr_t > &  header)
explicit

creates a SamHeader given htslib object.

creates a SamHeader object that points to htslib memory already allocated

Note
used by all iterators
the resulting SamHeader object shares ownership of the pre-allocated memory via shared_ptr reference counting
gamgee::SamHeader::SamHeader ( const SamHeader other)

makes a deep copy of a SamHeader. Shared pointers maintain state to all other associated objects correctly.

creates a deep copy of a SamHeader object

Note
the copy will have exclusive ownership over the newly-allocated htslib memory
gamgee::SamHeader::SamHeader ( SamHeader &&  other)
default

moves SamHeader accordingly. Shared pointers maintain state to all other associated objects correctly.

Member Function Documentation

uint32_t gamgee::SamHeader::n_sequences ( ) const
inline

Returns the number of reference sequences in the header.

SamHeader & gamgee::SamHeader::operator= ( const SamHeader other)

deep copy assignment of a SamHeader. Shared pointers maintain state to all other associated objects correctly.

creates a deep copy of a SamHeader object

Note
the copy will have exclusive ownership over the newly-allocated htslib memory

< shared_ptr assignment will take care of deallocating old sam record if necessary

SamHeader& gamgee::SamHeader::operator= ( SamHeader &&  other)
default

move assignment of a SamHeader. Shared pointers maintain state to all other associated objects correctly.

vector< ReadGroup > gamgee::SamHeader::read_groups ( ) const

extracts read group objects from a SAM header

uint32_t gamgee::SamHeader::sequence_length ( const std::string &  sequence_name) const

Returns the length of the given reference sequence as stored in the @SQ tag in the BAM header.

Returns the length of the given sequence as stored in the @SQ tag in the BAM header, or 0 if the sequence name is not found.

uint32_t gamgee::SamHeader::sequence_length ( const uint32_t  sequence_index) const
inline

Returns the length of the given reference sequence as stored in the @SQ tag in the BAM header.

std::string gamgee::SamHeader::sequence_name ( const uint32_t  sequence_index) const
inline

Returns the sequence name for the sequence with the given zero-based index.

Friends And Related Function Documentation

friend class SamBuilder
friend
friend class SamWriter
friend

The documentation for this class was generated from the following files: