Difference between revisions of "C++ Library: libStatGen"
Line 3: | Line 3: | ||
[[Category:libStatGen]] | [[Category:libStatGen]] | ||
− | = | + | = Description = |
Open source, freely available (GPL license), easy to use C++ APIs | Open source, freely available (GPL license), easy to use C++ APIs | ||
* General Operation Classes including: | * General Operation Classes including: | ||
Line 9: | Line 9: | ||
** String processing | ** String processing | ||
** Parameter Parsing | ** Parameter Parsing | ||
− | * Statistical Genetic Specific Classes including: | + | * '''Statistical Genetic Specific Classes''' including: |
− | **Handling Common file formats – SAM/BAM, FASTQ, GLF | + | **Handling Common file formats – SAM/BAM, FASTQ, GLF, VCF (coming soon) |
***Accessors to get/set values | ***Accessors to get/set values | ||
***Indexed access to BAM files | ***Indexed access to BAM files | ||
Line 16: | Line 16: | ||
***Cigar – interpretation and mapping between query and reference | ***Cigar – interpretation and mapping between query and reference | ||
***Pileup – structured access to data by individual reference position | ***Pileup – structured access to data by individual reference position | ||
+ | |||
+ | = Where to Find It = | ||
+ | libStatGen can be found at: [https://github.com/statgen/libStatGen https://github.com/statgen/libStatGen] | ||
+ | |||
+ | You can both browse and download the library at that address. | ||
+ | |||
+ | This is also a git repository. You can create your own git clone from this location: | ||
+ | git clone https://github.com/statgen/libStatGen.git | ||
+ | or | ||
+ | git clone git://github.com/statgen/libStatGen.git | ||
+ | |||
+ | Either of these commands create a directory called <code>libStatGen</code> in the current directory. | ||
+ | |||
+ | If you decide to use git, but need a refresher, see [[How To Use Git]] or [https://statgen.sph.umich.edu/wiki/How_To_Use_Git Notes on how to use git] (if you have access) | ||
+ | |||
+ | = What has changed = | ||
+ | The <code>pipeline</code> and <code>statgen</code> repositories have been deprecated, so please update to our new framework. | ||
+ | |||
+ | libStatGen is the new git repository for our library code. | ||
+ | |||
+ | There are now separate repositories for specific tools/groups of tools, allowing us to track everything separately so it is easier to follow changes that impact a specific tool or the library in general. | ||
= Library Documentation = | = Library Documentation = | ||
− | Latest Doxygen documentation: | + | Latest Doxygen documentation: <span style="color:#B22222">Coming Soon</span> |
− | [ | + | |
+ | Additional documentation: <span style="color:#B22222">Currently outdated, but updates will be coming soon</span> | ||
+ | * [[libStatGen: general]] - General classes for file processing and performing common tasks (used by most other libraries). | ||
+ | * [[libStatGen: BAM]] - Classes specific for reading/writing/analyzing SAM/BAM files. | ||
+ | * [[libStatGen: GLF]] - Classes specific for reading/writing/analyzing GLF files. | ||
+ | * [[libStatGen: FASTQ]] - Classes specific for reading/writing/analyzing FastQ files. | ||
+ | |||
+ | = Using the Library = | ||
+ | == Building the Library == | ||
+ | |||
+ | If you type make help, you get the build options. | ||
+ | <pre> | ||
+ | Makefile help | ||
+ | ------------- | ||
+ | Type... To... | ||
+ | make Compile opt | ||
+ | make help Display this help screen | ||
+ | make all Compile everything (opt, debug, & profile) | ||
+ | make opt Compile optimized | ||
+ | make debug Compile for debug | ||
+ | make profile Compile for profile | ||
+ | make clean Delete temporary files | ||
+ | make test Execute tests (if there are any) | ||
+ | </pre> | ||
+ | |||
+ | When you just type make, it will by default to make opt. | ||
+ | |||
+ | Make all indicates opt, debug, and profile. | ||
+ | |||
+ | opt creates libStatGen.a, debug creates libStatGen_debug.a, profile creates libStatGen_profile.a | ||
− | + | These libraries are created in the top level libStatGen directory and can then be linked to appropriately for optimized, debugging, or profiling builds. | |
− | + | == Navigating the Library Subdirectories == | |
− | * | + | Under the main libStatGen repository, there are: |
− | * | + | *bam - library code for operating on bam files. |
− | * | + | *copyrights - copyrights for the library and any code included with it. |
− | * | + | *fastq - library code for operating on fastq files. |
+ | *general - library code for general operations | ||
+ | *glf - library code for operating on glf files. | ||
+ | *include - after compiling, the library headers are linked here | ||
+ | *Makefiles - directory containing Makefiles that are used in the library and can be used for developing programs using the library | ||
+ | *samtools - library code used from samtools | ||
+ | |||
+ | After Compiling: libStatGen.a, libStatGen_debug.a, libStatGen_profile.a are created at the top level. | ||
+ | |||
+ | === bam, fastq, general, glf, samtools === | ||
+ | Object files are placed in an obj directory under each subdirectory with debug & profile objects in obj/debug and obj/profile. | ||
+ | |||
+ | Most also have a test directory. Tests are executed by running <code>make test</code> | ||
+ | |||
+ | === Makefiles === | ||
+ | This directory contains base makefiles and makefile settings that are used by the library and by programs being written to use the library. | ||
+ | |||
+ | == Using the Library in Your Own Program == | ||
+ | <span style="color:#B22222">Coming Soon</span> | ||
+ | |||
+ | ''' Below are the outdated instructions for <code>statgen</code> | ||
− | |||
In the following instructions/comments: | In the following instructions/comments: | ||
* replace STATGEN_DIR with the path to where the statgen directory is located (does not include statgen/). | * replace STATGEN_DIR with the path to where the statgen directory is located (does not include statgen/). |
Revision as of 16:54, 22 August 2011
Description
Open source, freely available (GPL license), easy to use C++ APIs
- General Operation Classes including:
- File/Stream I/O – uncompressed, BGZF, GZIP, stdin, stdout
- String processing
- Parameter Parsing
- Statistical Genetic Specific Classes including:
- Handling Common file formats – SAM/BAM, FASTQ, GLF, VCF (coming soon)
- Accessors to get/set values
- Indexed access to BAM files
- Utility classes, including:
- Cigar – interpretation and mapping between query and reference
- Pileup – structured access to data by individual reference position
- Handling Common file formats – SAM/BAM, FASTQ, GLF, VCF (coming soon)
Where to Find It
libStatGen can be found at: https://github.com/statgen/libStatGen
You can both browse and download the library at that address.
This is also a git repository. You can create your own git clone from this location:
git clone https://github.com/statgen/libStatGen.git
or
git clone git://github.com/statgen/libStatGen.git
Either of these commands create a directory called libStatGen
in the current directory.
If you decide to use git, but need a refresher, see How To Use Git or Notes on how to use git (if you have access)
What has changed
The pipeline
and statgen
repositories have been deprecated, so please update to our new framework.
libStatGen is the new git repository for our library code.
There are now separate repositories for specific tools/groups of tools, allowing us to track everything separately so it is easier to follow changes that impact a specific tool or the library in general.
Library Documentation
Latest Doxygen documentation: Coming Soon
Additional documentation: Currently outdated, but updates will be coming soon
- libStatGen: general - General classes for file processing and performing common tasks (used by most other libraries).
- libStatGen: BAM - Classes specific for reading/writing/analyzing SAM/BAM files.
- libStatGen: GLF - Classes specific for reading/writing/analyzing GLF files.
- libStatGen: FASTQ - Classes specific for reading/writing/analyzing FastQ files.
Using the Library
Building the Library
If you type make help, you get the build options.
Makefile help ------------- Type... To... make Compile opt make help Display this help screen make all Compile everything (opt, debug, & profile) make opt Compile optimized make debug Compile for debug make profile Compile for profile make clean Delete temporary files make test Execute tests (if there are any)
When you just type make, it will by default to make opt.
Make all indicates opt, debug, and profile.
opt creates libStatGen.a, debug creates libStatGen_debug.a, profile creates libStatGen_profile.a
These libraries are created in the top level libStatGen directory and can then be linked to appropriately for optimized, debugging, or profiling builds.
Under the main libStatGen repository, there are:
- bam - library code for operating on bam files.
- copyrights - copyrights for the library and any code included with it.
- fastq - library code for operating on fastq files.
- general - library code for general operations
- glf - library code for operating on glf files.
- include - after compiling, the library headers are linked here
- Makefiles - directory containing Makefiles that are used in the library and can be used for developing programs using the library
- samtools - library code used from samtools
After Compiling: libStatGen.a, libStatGen_debug.a, libStatGen_profile.a are created at the top level.
bam, fastq, general, glf, samtools
Object files are placed in an obj directory under each subdirectory with debug & profile objects in obj/debug and obj/profile.
Most also have a test directory. Tests are executed by running make test
Makefiles
This directory contains base makefiles and makefile settings that are used by the library and by programs being written to use the library.
Using the Library in Your Own Program
Coming Soon
Below are the outdated instructions for statgen
In the following instructions/comments:
- replace STATGEN_DIR with the path to where the statgen directory is located (does not include statgen/).
- replace MY_CODE_DIR with the path where you want your code located.
To use the StatGen Library, first download and compile via StatGen Download Instructions and StatGen Compile/Build Instructions
This creates the library: STATGEN_DIR/statgen/lib/libStatGen.a, where STATGEN_DIR is the path to where you dec
Creating programs using the Default Makefile
- Create a directory for your own code.
mkdir MY_CODE_DIR
- Move into your directory.
cd MY_CODE_DIR
- Copy the Makefile from the statgen directory.
cp STATGEN_DIR/statgen/src/Makefile.src Makefile
- You could instead link the Makefile, but then be careful not to modify it for your program because that may break any other programs that link to it (including those with the statgen repository).
- Create
Makefile.tool
- See Makefile.tool for what to put into Makefile.tool.
- Compile your program
- For optimal performance (be sure you also compiled statgen for optimal performance):
make
- For debug (be sure that you also compiled statgen for debug):
make OPTFLAG="-ggdb -O0"
- For optimal performance (be sure you also compiled statgen for optimal performance):
NOTE: When you compile, all of your '.o' files will go in a directory called obj that will be created by the Makefile if it does not already exist.
Creating programs Without the Default Makefile
You can also use your own Makefile or method of building.
Just be sure to add -ISTAGEN_DIR/statgen/lib/include to your compile line to pull in the library header files.
Add STATGEN_DIR/stagen/lib/libStatGen.a STATGEN_DIR/statgen/lib/samtools/libbam.a -lm -lz -lssl
in that order to the end of your compile line to pull in the necessary libraries.
NOTE: These are all handled for you if you use Makefile.src from the statgen repository.
Recently Added Capabilities