]> git.donarmstrong.com Git - bamtools.git/blobdiff - bamtools_sort.h
fixed potential bug with previous commit
[bamtools.git] / bamtools_sort.h
index 18e435f9d03fc7a53ed4d54bbc4effa28fdc20de..7d2ac5ac8cc24d5237f71fbcf3c777b611b6aa83 100644 (file)
@@ -1,70 +1,35 @@
 // ***************************************************************************
-// bamtools_sortt.h (c) 2010 Derek Barnett, Erik Garrison
+// bamtools_sort.h (c) 2010 Derek Barnett, Erik Garrison
 // Marth Lab, Department of Biology, Boston College
 // All rights reserved.
 // ---------------------------------------------------------------------------
-// Last modified: 26 May 2010
+// Last modified: 1 June 2010
 // ---------------------------------------------------------------------------
-// Sorts an input BAM file (default by position) and stores in a new BAM file.
+// Sorts a BAM file.
 // ***************************************************************************
 
 #ifndef BAMTOOLS_SORT_H
 #define BAMTOOLS_SORT_H
 
-#include <iostream>
-#include <string>
-
-#include "BamReader.h"
-#include "bamtools_getopt.h"
+#include "bamtools_tool.h"
 
 namespace BamTools {
-
-int BamSortHelp(void) { 
-    std::cerr << std::endl;
-    std::cerr << "usage:\tbamtools sort [--in BAM file] [--out sorted BAM file]" << std::endl;
-    std::cerr << "\t-i, --in\tInput BAM file to sort\t[default=stdin]" << std::endl;
-    std::cerr << "\t-o. --out\tDestination of sorted BAM file\t[default=stdout]" << std::endl;
-    std::cerr << std::endl;
-    return 0;
-}
-
-int RunBamSort(int argc, char* argv[]) {
   
-    // else parse command line for args  
-    GetOpt options(argc, argv, 1);
-    
-    std::string inputFilename;
-    options.addOption('i', "in", &inputFilename);
-    
-    std::string outputFilename;
-    options.addOption('o', "out", &outputFilename);
-    
-    if ( !options.parse() ) return BamCoverageHelp();
-    if ( inputFilename.empty() )  { inputFilename  = "stdin"; }
-    if ( outputFilename.empty() ) { outputFilename = "stdout"; }
-    
-    // open our BAM reader
-//     BamReader reader;
-//     reader.Open(inputFilename);
-//     
-//     // retrieve header & reference dictionary info
-//     std::string header = reader.GetHeaderText();
-//     RefVector references = reader.GetReferenceData(); 
-//     
-//     BamWriter writer;
-//     writer.Open(outputFilename, header, references);
-//     
-    // sort BAM file
-    std::cerr << "Sorting " << inputFilename << std::endl;
-    std::cerr << "Saving sorted BAM in " << outputFilename << endl;
-    std::cerr << "FEATURE NOT YET IMPLEMENTED!" << std::endl;
-    
-    // clean & exit
-//     reader.Close();
-//     writer.Close();
-    return 0;
-}
-
+class SortTool : public AbstractTool {
+  
+    public:
+        SortTool(void);
+        ~SortTool(void);
+  
+    public:
+        int Help(void);
+        int Run(int argc, char* argv[]); 
+        
+    private:
+        struct SortSettings;
+        SortSettings* m_settings;
+};
+  
 } // namespace BamTools
 
-#endif // BAMTOOLS_SORT_H
\ No newline at end of file
+#endif // BAMTOOLS_SORT_H