|
BitMagic-C++
|
Example: Use of sparse vector for compressed DNA strings. More...
#include <assert.h>#include <stdlib.h>#include <iostream>#include <vector>#include <algorithm>#include <utility>#include "bm.h"#include "bmsparsevec.h"#include "bmsparsevec_algo.h"#include "bmsparsevec_serial.h"#include "bmdbg.h"#include "bmtimer.h"#include "bmundef.h"
Go to the source code of this file.
Typedefs | |
| typedef bm::sparse_vector< unsigned, bm::bvector<> > | svector_u32 |
| typedef std::vector< char > | vector_char_type |
| typedef std::vector< std::pair< unsigned, unsigned > > | vector_pairs_type |
Functions | |
| unsigned | DNA2int (char DNA_bp) |
| Translate DNA letter to integer code Please note this function uses extended alphabet ATGC plus 'N' and '$' Ns are used to indicate ambiguity and $ is part of Burrows-Wheeler transform. | |
| char | int2DNA (unsigned code) |
| Translate integer code to DNA letter. | |
| template<typename SV> | |
| void | PrintSV (const SV &sv) |
| Print sparse vector. | |
| template<typename SV, typename VECT> | |
| void | TestSV (const SV &sv, const VECT &vect) |
| Test sparse vector against reference vector (for QA purposes). | |
| static int | compare_sv (const svector_u32 &sv1, const svector_u32 &sv2) |
| static int | compare_sv_it (const svector_u32 &sv1, const svector_u32 &sv2) |
| static void | generate_DNA_vector (svector_u32 &sv, vector_char_type &vect, unsigned sz) |
| static void | add_centromer_Ns (svector_u32 &sv, vector_char_type &vect, unsigned csz) |
| static void | generate_big_case (svector_u32 &sv, vector_char_type &vect) |
| static void | generate_mismatches (vector_pairs_type &vect_m, const vector_char_type &vect, unsigned m_count) |
| static void | test_mismatch_search (const svector_u32 &sv, const vector_pairs_type &vect_m) |
| static void | test_vect_mismatch_search (const vector_char_type &vect, const vector_pairs_type &vect_m) |
| static void | test_strcmp (const vector_char_type &vect, const vector_pairs_type &vect_m) |
| static void | test_sv_cmp (const svector_u32 &sv, const vector_pairs_type &vect_m) |
| void | test_sv_cmp_it (const svector_u32 &sv, const vector_pairs_type &vect_m) |
| int | main (void) |
Variables | |
| const unsigned | rep = 20000 |
| bm::chrono_taker ::duration_map_type | timing_map |
Example: Use of sparse vector for compressed DNA strings.
Definition in file xsample06.cpp.
| typedef bm::sparse_vector<unsigned, bm::bvector<> > svector_u32 |
Definition at line 132 of file xsample06.cpp.
| typedef std::vector<char> vector_char_type |
Definition at line 133 of file xsample06.cpp.
| typedef std::vector<std::pair<unsigned, unsigned> > vector_pairs_type |
Definition at line 134 of file xsample06.cpp.
|
static |
Definition at line 201 of file xsample06.cpp.
References DNA2int(), and bm::sparse_vector< Val, BV >::size().
Referenced by generate_big_case().
|
static |
Definition at line 141 of file xsample06.cpp.
References bm::sparse_vector_find_first_mismatch().
Referenced by test_sv_cmp().
|
static |
Definition at line 162 of file xsample06.cpp.
References bm::sparse_vector< Val, BV >::begin(), and bm::sparse_vector< Val, BV >::size().
Referenced by test_sv_cmp_it().
|
inline |
Translate DNA letter to integer code Please note this function uses extended alphabet ATGC plus 'N' and '$' Ns are used to indicate ambiguity and $ is part of Burrows-Wheeler transform.
Definition at line 58 of file xsample06.cpp.
Referenced by add_centromer_Ns(), and main().
|
static |
Definition at line 226 of file xsample06.cpp.
References add_centromer_Ns(), generate_DNA_vector(), bm::sparse_vector< Val, BV >::optimize(), and TestSV().
Referenced by main().
|
static |
Definition at line 183 of file xsample06.cpp.
References bm::sparse_vector< Val, BV >::get_back_inserter(), and int2DNA().
Referenced by generate_big_case().
|
static |
Definition at line 243 of file xsample06.cpp.
References int2DNA().
Referenced by main().
|
inline |
Translate integer code to DNA letter.
Definition at line 81 of file xsample06.cpp.
Referenced by generate_DNA_vector(), generate_mismatches(), PrintSV(), test_strcmp(), test_vect_mismatch_search(), and TestSV().
| int main | ( | void | ) |
Definition at line 461 of file xsample06.cpp.
References bm::chrono_taker< TOut >::ct_time, DNA2int(), generate_big_case(), generate_mismatches(), bm::sparse_vector< Val, BV >::get_back_inserter(), bm::sparse_vector< Val, BV >::optimize(), bm::chrono_taker< TOut >::print_duration_map(), PrintSV(), rep, test_mismatch_search(), test_strcmp(), test_sv_cmp(), test_sv_cmp_it(), test_vect_mismatch_search(), and timing_map.
| void PrintSV | ( | const SV & | sv | ) |
Print sparse vector.
Definition at line 91 of file xsample06.cpp.
References int2DNA().
Referenced by main().
|
static |
Definition at line 288 of file xsample06.cpp.
References bm::sparse_vector< Val, BV >::set(), bm::sparse_vector_find_first_mismatch(), and timing_map.
Referenced by main().
|
static |
Definition at line 367 of file xsample06.cpp.
References int2DNA(), and timing_map.
Referenced by main().
|
static |
Definition at line 402 of file xsample06.cpp.
References compare_sv(), bm::sparse_vector< Val, BV >::set(), and timing_map.
Referenced by main().
|
inline |
Definition at line 432 of file xsample06.cpp.
References compare_sv_it(), bm::sparse_vector< Val, BV >::set(), and timing_map.
Referenced by main().
|
static |
Definition at line 321 of file xsample06.cpp.
References int2DNA(), and timing_map.
Referenced by main().
| void TestSV | ( | const SV & | sv, |
| const VECT & | vect ) |
Test sparse vector against reference vector (for QA purposes).
Definition at line 108 of file xsample06.cpp.
References int2DNA().
Referenced by generate_big_case().
| const unsigned rep = 20000 |
| bm::chrono_taker ::duration_map_type timing_map |
Definition at line 281 of file xsample06.cpp.