GATB-Core example code snippets
This directory contains many ready-to-compile code snippets you can use to learn GATB-Core c++ API.
The following third parties have to be already installed to compile GATB-Core examples:
- a C++/11 capable compiler (e.g. gcc 4.7+, clang 3.5+, Apple/clang 6.0+)
- CMake 3.1+
Compile GATB-CORE snippets
Get a copy of the project
If not already done:
cd <some_directory> git clone https://github.com/GATB/gatb-core.git
Compile all snippets
cd <some_directory>/gatb-core/gatb-core mkdir build cd build cmake -DGATB_CORE_INCLUDE_EXAMPLES=True -DCMAKE_BUILD_TYPE=Debug .. make -j8 examples
Compile a particular snippet
Instead of using:
make -j8 examples
make -j8 bank15
to compile snippet "bank15.cpp". Apply the same recipe to compile any other code snippets.
Alternatively, you can use the provided "makefile" script to compile a single example. It needs to be modified to point to the correct path of the GATB-core library. Maybe it will need some tweaking (try removing the "-static" flag if compilation fails).
Try it, from this folder:
should compile the first bank1.cpp example
Run a compiled code snippet
Have a look at the begining of each c++ source code: you'll see how to use the example programs.
For instance, taking the above example "bank15.cpp", you run it as follows:
# from within the 'build' directory: ./bin/bank15 ../test/db/reads1.fa
Basic APIs explained:
- Bank: read/write FastA and FastQ files (plain text and gzip)
- Iterator: go through a Bank by iterating over its sequences
- k-mer: from sequences to k-mers
- De Bruijn Graph: from sequences to De Bruijn Graphs
Advanced APIs explained:
- Multi-threading: easy way to manage multi-threaded tasks on Linux and OSX
- Storage: easy way to handle HDF5 storage
Make your own full-featured GATB-Tool:
- Tool API: make a command-line based tool quickly
The complete GATB-Core API reference documentation is here.
Some of these code snippets are also available for direct use from the GATB-Core online Tutorial.
To contact a developer, request help, etc, use:
GATB is free software; you can redistribute it and/or modify it under the Affero GPL v3 license.