SHOGUN  v1.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
List of all members | Public Member Functions
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 28 of file BitString.h.

Inheritance diagram for CBitString:
Inheritance graph
[legend]

Public Member Functions

 CBitString ()
 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)
void create (uint64_t len)
uint64_t operator[] (uint64_t index) const
void set_binary_word (uint16_t word, uint64_t index)
uint64_t get_length () const
virtual const char * get_name () const
- Public Member Functions inherited from CSGObject
 CSGObject ()
 CSGObject (const CSGObject &orig)
virtual ~CSGObject ()
virtual bool is_generic (EPrimitiveType *generic) const
template<class T >
void set_generic ()
void unset_generic ()
virtual void print_serializable (const char *prefix="")
virtual bool save_serializable (CSerializableFile *file, const char *prefix="")
virtual bool load_serializable (CSerializableFile *file, const char *prefix="")
void set_global_io (SGIO *io)
SGIOget_global_io ()
void set_global_parallel (Parallel *parallel)
Parallelget_global_parallel ()
void set_global_version (Version *version)
Versionget_global_version ()
SGVector< char * > get_modelsel_names ()
char * get_modsel_param_descr (const char *param_name)
index_t get_modsel_param_index (const char *param_name)

Additional Inherited Members

- Public Attributes inherited from CSGObject
SGIOio
Parallelparallel
Versionversion
Parameterm_parameters
Parameterm_model_selection_parameters
- Protected Member Functions inherited from CSGObject
virtual void load_serializable_pre () throw (ShogunException)
virtual void load_serializable_post () throw (ShogunException)
virtual void save_serializable_pre () throw (ShogunException)
virtual void save_serializable_post () throw (ShogunException)

Constructor & Destructor Documentation

default constructor

Definition at line 32 of file BitString.h.

CBitString ( EAlphabet  alpha,
int32_t  width = 1 
)

default constructor

creates an empty Bitstring

Parameters
alphaAlphabet
widthreturn this many bits upon str[idx] access operations

Definition at line 50 of file BitString.h.

~CBitString ( )

destructor

Definition at line 67 of file BitString.h.

Member Function Documentation

void cleanup ( )

free up memory

Definition at line 74 of file BitString.h.

void create ( uint64_t  len)

creates string of all zeros of len bits

Parameters
lenlength of string in bits

Definition at line 221 of file BitString.h.

uint64_t get_length ( ) const
Returns
length of the string in bits

Definition at line 329 of file BitString.h.

virtual const char* get_name ( ) const
virtual
Returns
object name

Implements CSGObject.

Definition at line 332 of file BitString.h.

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

load fasta file as bit string

Parameters
fnamefilename to load from
ignore_invalidif set to true, characters other than A,C,G,T are converted to A
Returns
if loading was successful

Definition at line 123 of file BitString.h.

void obtain_from_char ( char *  str,
uint64_t  len 
)

convert string of length len into bit sequence

Parameters
strstring
lenlength of string in bits

Definition at line 86 of file BitString.h.

uint64_t operator[] ( uint64_t  index) const

access array by [] operator

Parameters
indexindex into array

Definition at line 263 of file BitString.h.

void set_binary_word ( uint16_t  word,
uint64_t  index 
)

set a binary word

Parameters
word16 bit word to be set
indexword based index

Definition at line 289 of file BitString.h.

void set_string ( uint64_t *  str,
uint64_t  len 
)

set string of length len embedded in a uint64_t sequence

Parameters
strstring
lenlength of string in bits

Definition at line 210 of file BitString.h.


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

SHOGUN Machine Learning Toolbox - Documentation