-
Notifications
You must be signed in to change notification settings - Fork 13
app guide
The BLISS library contains high level api for integration into exisiting or new applications.
The design goals of these APIs are
- semantically clear
- simple to use
- hides (most of) complexity of parallel backend
- easy to extend
The flexibility and extensibility of BLISS primarily comes from C++ templates, which not only allows an implementation to support different data types, but also different pluggable function modules.
A very simple example of c++ templates can be seen in the standard template library's container classes.
std::vector<int> integers;
integers.push_back(1);
std::vector<float> floats;
floats.push_back(1.0);The example above shows how the same vector container can be used with 2 different data types.
A class can also be specialized for a particular template parameter type, so that data type specific algorithm is used for greater efficiency or accuracy. For example,
log2<unsigned int>(10);
log2<float>(10.0);The first case can be implemented using bit shifting, while the second case requires floating point computation.
Finally, it is also possible to use template parameter to directly replace specific logic. For example, the hash function of a hashmap (unordered_map in C++ STL) can be replaced.
std::unordered_map<int, float, std::hash<int>> intHashMap;
std::unordered_map<int, float, my_md5<int>> md5HashMap;BLISS heavily utilizes C++ templates to support extensibility and flexibility, as illustrated in the next section.
Three Kmer Indexes classes are currently provided. All use MPI and OpenMP as their parallel backend.
template<unsigned int Kmer_Size, typename Alphabet> class KmerCountIndex;template<unsigned int Kmer_Size, typename Alphabet> class KmerPositionIndex;template<unsigned int Kmer_Size, typename Alphabet> class KmerPositionAndQualityIndex;Each of these classes provide the following functions:
void build(const std::string &filename, const int &nthreads)void sendQuery(const KmerType & kmer)void flushQuery()void query(const std::vector<KmerType>& kmers)MapType& getLocalIndex()void finalize()