Open main menu

Genome Analysis Wiki β

Changes

C++ Library: libStatGen

1,451 bytes removed, 10:28, 23 August 2011
no edit summary
= Library Documentation =
Latest Doxygen documentation: <span style="color[http:#B22222">Coming Soon</span>/www.sph.umich.edu/csg/mktrost/doxygen/2011_08_23/ 8/23/11 Library Documentation in Doxygen]
Additional documentation: <span style="color:#B22222">Currently outdated, but updates will be coming soon</span>
== Using the Library in Your Own Program ==
=== Using SampleProgram as Starting from a starting point Sample Program ===[https://github.com/statgen/SampleProgram https://github.com/statgen/SampleProgram] is a simple program demonstrating how to write a tool that uses libStatGen. You and can copy SampleProgram and use it be used as a starting point for your own program. In the main SampleProgram directory, update ChangeLog, .gitignore, and README.txt as appropriate. No changes to Makefile should be necessary. Update Makefile.inc, replacing all occurrences of <code>LIB_PATH_SAMPLE_PROGRAM</code> with <code>LIB_PATH_YOUR_PROGRAM_NAME</code> where <code>YOUR_PROGRAM_NAME</code> is a unique name that can be used to set an environment variable to locate the library for your programtool. (Most likely this won't need to be set, but is there in case you need it.)  
SampleProgram has 4 subdirectories:
* src - this is where your own program code goes
* test - this is where your test code goes. Test code can be setup to run with <code>make test</code> to ensure the program works properly.
 
'''Using SampleProgram as a starting point for your tool:'''
# Copy SampleProgram into a directory with your program name (it is the starting point for your own program).
# Update ChangeLog, .gitignore, and README.txt as appropriate.
# Add any necessary copyrights to the copyrights directory.
#* No changes to Makefile should be necessary.
# Update Makefile.inc
## Update the VERSION as necessary.
## Replace all occurrences of <code>SAMPLE_PROGRAM</code> with an all caps name for your program.
##* You can then use the <code>LIB_PATH_<your program name></code> environment variable to specify an alternate path to libStatGen specific for your program. In most cases you will not need to do this.
#* No other updates to Makefile.inc should be necessary.
# Add your program (cpp & h files) to the <code>src</code> directory.
# Update src/Makefile
## Set EXE to your program executable (replacing sampleProgram)
## Set TOOLBASE, SRCONLY, and HDRONLY as appropriate for specifying your program file names.
## Set any of the other optional settings as specified in the sample makefile.
#* No other changes should be necessary to src/Makefile.
# Add your tests to the <code>test</code> directory.
# Update test/Makefile as appropriate for specifying how to compile/run your tests.
 
=== Working from Scratch ===
When compiling your code, be sure to include the library header files found in libStatgen/include/ and link in the appropriate library (opt, debug, or profile).
 
 
<span style="color:#B22222">Coming Soon</span>
 
 
''' Below are the outdated instructions for <code>statgen</code>
 
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 | StatGen Download Instructions]] and [[StatGen Repository#Compile.2FBuild | 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.
#* <code>mkdir MY_CODE_DIR</code>
# Move into your directory.
#* <code>cd MY_CODE_DIR</code>
# Copy the Makefile from the statgen directory.
#* <code>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 <code>Makefile.tool</code>
#* 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):
#** <code>make</code>
#* For debug (be sure that you also compiled statgen for debug):
#** <code>make OPTFLAG="-ggdb -O0"</code>
 
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 <code>STATGEN_DIR/stagen/lib/libStatGen.a STATGEN_DIR/statgen/lib/samtools/libbam.a -lm -lz -lssl</code> 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 =
* [[SAM/BAM Convert Sequence|SAM/BAM support conversion between '=' and the base in a sequence]]