CBitString Class Reference


Detailed Description

a string class embedding a string in a compact bit representation

especially useful to compactly represent genomic DNA

(or any other string of small alphabet size)

Definition at line 26 of file BitString.h.

Inheritance diagram for CBitString:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 CBitString (EAlphabet alpha, int32_t width=1)
 ~CBitString ()
void cleanup ()
void obtain_from_char (char *str, uint64_t len)
void load_fasta_file (const char *fname, bool ignore_invalid=false)
void set_string (uint64_t *str, uint64_t len)
uint64_t condense (uint64_t bits, uint64_t mask) const
uint64_t operator[] (uint64_t index) const
uint64_t get_length () const
virtual const char * get_name () const

Constructor & Destructor Documentation

CBitString::CBitString ( EAlphabet  alpha,
int32_t  width = 1 
)

default constructor

creates an empty Bitstring

Parameters:
alpha Alphabet
width return this many bits upon str[idx] access operations

Definition at line 36 of file BitString.h.

CBitString::~CBitString (  ) 

destructor

Definition at line 49 of file BitString.h.


Member Function Documentation

void CBitString::cleanup (  ) 

free up memory

Definition at line 56 of file BitString.h.

uint64_t CBitString::condense ( uint64_t  bits,
uint64_t  mask 
) const

Definition at line 199 of file BitString.h.

uint64_t CBitString::get_length (  )  const

Definition at line 248 of file BitString.h.

virtual const char* CBitString::get_name (  )  const [virtual]
Returns:
object name

Implements CSGObject.

Definition at line 251 of file BitString.h.

void CBitString::load_fasta_file ( const char *  fname,
bool  ignore_invalid = false 
)

load fasta file as bit string

Parameters:
fname filename to load from
ignore_invalid if set to true, characters other than A,C,G,T are converted to A
Returns:
if loading was successful

Definition at line 105 of file BitString.h.

void CBitString::obtain_from_char ( char *  str,
uint64_t  len 
)

convert string of length len into bit sequence

Parameters:
str string
len length of string in bits

Definition at line 68 of file BitString.h.

uint64_t CBitString::operator[] ( uint64_t  index  )  const

Definition at line 227 of file BitString.h.

void CBitString::set_string ( uint64_t *  str,
uint64_t  len 
)

set string of length len embedded in a uint64_t sequence

Parameters:
str string
len length of string in bits

Definition at line 192 of file BitString.h.


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

SHOGUN Machine Learning Toolbox - Documentation