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] FILE" << std::endl;
26 std::cerr << std::endl;
27 std::cerr << "\t--nclist Use NCList indexing scheme (faster?) [off] ** JUST HERE AS POSSIBLE SWITCH EXAMPLE FOR NOW **" << std::endl;
28 std::cerr << "\tFILE Input BAM file to generate index from [REQUIRED]" << std::endl;
29 std::cerr << std::endl;
33 int RunBamIndex(int argc, char* argv[]) {
35 // else parse command line for args
36 GetOpt options(argc, argv, 1);
38 std::string inputFilename;
39 options.addRequiredArgument("input", &inputFilename);
42 options.addSwitch("nclist", &useNCList);
44 if ( !options.parse() ) return BamIndexHelp();
46 // open our BAM reader
48 reader.Open(inputFilename);
50 // create index for BAM file
58 } // namespace BamTools
60 #endif // BAMTOOLS_INDEX_H