Thank you very much.
Greetings,
I am writing a C++ program to analyze BAM files. I am new to C and C++. I was wondering if anyone had some examples using the Samtools C headers in C++. So far I have been using the awesome Bamtools API, but I want to try the faidx.h header to access fasta sequences.
I have read the documentation, but I learn best by reading through code.
1 answer
I played with the samtools API: see http://variationtoolkit.googlecode.com/svn/trunk/src/ (warning , not everything here should be used in production, some sources are just some ideas I'm testing...)
See
http://variationtoolkit.googlecode.com/svn/trunk/src/xfaidx.cpp and xfaidx.h for a C++ wrapper around fai*
http://variationtoolkit.googlecode.com/svn/trunk/src/bam1sequence.h for a C++ wrapper around bam1_t
etc...
there is also http://samtools.sourceforge.net/sam-exam.shtml
I am comfortable with the STL, getting to the point of being able to write useful tools. It would be a good exercise to implement my own fasta indexing schema.
Log in to answer this question.
Unless you absolutely want to go for speed, why not use a BAM API in a langauge you already know. Also maybe one the other API's already supports what you want to do.
Yup. If I was in "a get shit done mode" I would just hammer it out in a scripting language, but I am trying to learn a compiled language.
Learn Java :P It is a bit more high level language and still, object oriented, type safe and fast. And there is a good BAM API, Picard: http://picard.sourceforge.net/javadoc/