]> git.donarmstrong.com Git - bamtools.git/blob - bamtools_stats.cpp
added warning for duplicate @RG tag in header
[bamtools.git] / bamtools_stats.cpp
1 // ***************************************************************************
2 // bamtools_stats.cpp (c) 2010 Derek Barnett, Erik Garrison
3 // Marth Lab, Department of Biology, Boston College
4 // All rights reserved.
5 // ---------------------------------------------------------------------------
6 // Last modified: 1 June 2010
7 // ---------------------------------------------------------------------------
8 // Prints general statistics for a single BAM file
9 //
10 // ** Expand to multiple??
11 //
12 // ***************************************************************************
13
14 #include <iostream>
15 #include <string>
16
17 #include "bamtools_stats.h"
18 #include "bamtools_options.h"
19 #include "BamReader.h"
20
21 using namespace std;
22 using namespace BamTools;
23
24 // ---------------------------------------------
25 // StatsSettings implementation
26
27 struct StatsTool::StatsSettings {
28
29     // flags
30     bool HasInputBamFilename;
31
32     // filenames
33     string InputBamFilename;
34     
35     // constructor
36     StatsSettings(void)
37         : HasInputBamFilename(false)
38         , InputBamFilename(Options::StandardIn())
39     { }
40 };  
41
42 // ---------------------------------------------
43 // StatsTool implementation
44
45 StatsTool::StatsTool(void)
46     : AbstractTool()
47     , m_settings(new StatsSettings)
48 {
49     // set program details
50     Options::SetProgramInfo("bamtools stats", "prints general stats for a BAM file", "[-in <filename>]");
51     
52     // set up options 
53     OptionGroup* IO_Opts = Options::CreateOptionGroup("Input & Output");
54     Options::AddValueOption("-in", "BAM filename", "the input BAM file", "", m_settings->HasInputBamFilename,  m_settings->InputBamFilename,  IO_Opts, Options::StandardIn());
55 }
56
57 StatsTool::~StatsTool(void) {
58     delete m_settings;
59     m_settings = 0;
60 }
61
62 int StatsTool::Help(void) {
63     Options::DisplayHelp();
64     return 0;
65 }
66
67 int StatsTool::Run(int argc, char* argv[]) {
68   
69     // parse command line arguments
70     Options::Parse(argc, argv, 1);
71     
72     // calculate stats
73     
74     return 0;
75 }