]> git.donarmstrong.com Git - bamtools.git/blobdiff - bamtools_header.h
added warning for duplicate @RG tag in header
[bamtools.git] / bamtools_header.h
index f0544bb572df59a7a35b5290a5e94c13aa556616..c52e09041031afbd10268eb0ffb74aee3726ffe1 100644 (file)
@@ -3,57 +3,34 @@
 // Marth Lab, Department of Biology, Boston College
 // All rights reserved.
 // ---------------------------------------------------------------------------
-// Last modified: 26 May 2010
+// Last modified: 1 June 2010
 // ---------------------------------------------------------------------------
-// Prints the SAM-style header from a single BAM file (or merged header from
-// multiple BAM files) to stdout.
+// Prints the SAM-style header from a single BAM file ( or merged header from
+// multiple BAM files) to stdout
 // ***************************************************************************
 
 #ifndef BAMTOOLS_HEADER_H
 #define BAMTOOLS_HEADER_H
 
-#include <iostream>
-#include <string>
-#include <vector>
-
-#include "BamReader.h"
-#include "BamMultiReader.h"
-// #include "GetOpt.h"
-#include "bamtools_getopt.h"
+#include "bamtools_tool.h"
 
 namespace BamTools {
-
-int BamHeaderHelp(void) { 
-    std::cerr << std::endl;
-    std::cerr << "usage:\tbamtools header [BAM file1] [BAM file2] [BAM file3]..." << std::endl;
-    std::cerr << "\t[BAM file]\tInput file(s) to dump header contents from [default=stdin]" << std::endl;
-    std::cerr << std::endl;
-    return 0;
-}
-
-int RunBamHeader(int argc, char* argv[]) {
-
-    // else parse command line for args
-    GetOpt options(argc, argv, 1);
-    
-    std::vector<std::string> inputFilenames;
-    options.addVariableLengthOption("in", &inputFilenames);
-
-    if ( !options.parse() ) return BamHeaderHelp();
-    if ( inputFilenames.empty() ) { inputFilenames.push_back("stdin"); }
   
-    // open files
-    BamMultiReader reader;
-    reader.Open(inputFilenames, false);
+class HeaderTool : public AbstractTool {
+  
+    public:
+        HeaderTool(void);
+        ~HeaderTool(void);
+  
+    public:
+        int Help(void);
+        int Run(int argc, char* argv[]); 
         
-    // dump header contents to stdout
-    std::cout << reader.GetHeaderText() << std::endl;
-    
-    // clean up & exit
-    reader.Close();
-    return 0;
-}
-
+    private:
+        struct HeaderSettings;
+        HeaderSettings* m_settings;
+};
+  
 } // namespace BamTools
 
 #endif // BAMTOOLS_HEADER_H