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::ReadBases Class Reference

Utility class to handle the memory management of the sam record object for read bases. More...

#include <read_bases.h>

Public Member Functions

 ReadBases (const std::shared_ptr< bam1_t > &sam_record)
 creates a ReadBases object that points to htslib memory already allocated More...
 
 ReadBases (const ReadBases &other)
 creates a deep copy of a ReadBases object More...
 
 ReadBases (ReadBases &&other)=default
 
ReadBasesoperator= (const ReadBases &other)
 creates a deep copy of a ReadBases object More...
 
ReadBasesoperator= (ReadBases &&other)=default
 
 ~ReadBases ()=default
 default destruction is sufficient, since our shared_ptr will handle deallocation More...
 
Base operator[] (const uint32_t index) const
 use freely as you would an array. More...
 
void set_base (const uint32_t index, const Base base)
 modify a base at a specific index More...
 
uint32_t size () const
 
bool operator== (const ReadBases &other) const
 number of base qualities in the container More...
 
bool operator!= (const ReadBases &other) const
 check for inequality with another ReadBases object More...
 
std::string to_string () const
 produce a string representation of the bases in this object More...
 

Friends

class SamBuilder
 builder needs access to the internals in order to build efficiently More...
 

Detailed Description

Utility class to handle the memory management of the sam record object for read bases.

This class uses Base to represent the bases A,C,G,T,N so we can get byte by byte correspondence with the underlying compressed memory model.

Note
Any functionality lost because of this should be made available by the ReadBases class.

Constructor & Destructor Documentation

gamgee::ReadBases::ReadBases ( const std::shared_ptr< bam1_t > &  sam_record)
explicit

creates a ReadBases object that points to htslib memory already allocated

Parameters
sam_recorda shared pointer to an htslib raw sam record pointer for this object to take shared ownership
Note
the resulting ReadBases object shares ownership of the pre-allocated memory via shared_ptr reference counting
gamgee::ReadBases::ReadBases ( const ReadBases other)

creates a deep copy of a ReadBases object

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

default destruction is sufficient, since our shared_ptr will handle deallocation

Member Function Documentation

bool gamgee::ReadBases::operator!= ( const ReadBases other) const

check for inequality with another ReadBases object

check whether this object does not contain the same bases as another ReadBases object

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

creates a deep copy of a ReadBases 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

ReadBases& gamgee::ReadBases::operator= ( ReadBases &&  other)
default
bool gamgee::ReadBases::operator== ( const ReadBases other) const

number of base qualities in the container

check whether this object contains the same bases as another ReadBases object

check for equality with another ReadBases object

Base gamgee::ReadBases::operator[] ( const uint32_t  index) const

use freely as you would an array.

access an individual base by index

Note
currently implemented as read only
Returns
base at the specified index as an enumerated value
void gamgee::ReadBases::set_base ( const uint32_t  index,
const Base  base 
)

modify a base at a specific index

set an individual base at the given index to the specified value

Note
there's no way to implement this using non-const operator[], since we can't return a reference to a half-byte in memory

< zero out previous 4-bit base encoding

< insert new 4-bit base encoding

uint32_t gamgee::ReadBases::size ( ) const
inline
string gamgee::ReadBases::to_string ( ) const

produce a string representation of the bases in this object

returns a string representation of the bases in this read

Friends And Related Function Documentation

friend class SamBuilder
friend

builder needs access to the internals in order to build efficiently


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