1 // ***************************************************************************
2 // bamtools_index.h (c) 2010 Derek Barnett, Erik Garrison
3 // Marth Lab, Department of Biology, Boston College
4 // All rights reserved.
5 // ---------------------------------------------------------------------------
6 // Last modified: 26 May 2010
7 // ---------------------------------------------------------------------------
8 // Creates a BAM index (".bai") file for the provided BAM file.
9 // ***************************************************************************
11 #ifndef BAMTOOLS_INDEX_H
12 #define BAMTOOLS_INDEX_H
17 #include "BamReader.h"
18 // #include "GetOpt.h"
19 #include "bamtools_getopt.h"
23 int BamIndexHelp(void) {
24 std::cerr << std::endl;
25 std::cerr << "usage:\tbamtools index [--nclist] <BAM file>" << std::endl;
26 std::cerr << "\t--nclist\tUse NCList indexing scheme (faster?)\t[default=off] ** JUST HERE AS POSSIBLE SWITCH EXAMPLE FOR NOW **" << std::endl;
27 std::cerr << "\t<BAM file>\tInput BAM file to generate index from\t[req'd]" << std::endl;
28 std::cerr << std::endl;
32 int RunBamIndex(int argc, char* argv[]) {
34 // else parse command line for args
35 GetOpt options(argc, argv, 1);
37 std::string inputFilename;
38 options.addRequiredArgument("input", &inputFilename);
41 options.addSwitch("nclist", &useNCList);
43 if ( !options.parse() ) return BamIndexHelp();
45 // open our BAM reader
47 reader.Open(inputFilename);
49 // create index for BAM file
57 } // namespace BamTools
59 #endif // BAMTOOLS_INDEX_H