]> git.donarmstrong.com Git - bamtools.git/commitdiff
Fixed: sorting order lost during merge step of sort tool, if input BAM
authorderek <derekwbarnett@gmail.com>
Tue, 27 Mar 2012 16:03:54 +0000 (12:03 -0400)
committerderek <derekwbarnett@gmail.com>
Tue, 27 Mar 2012 16:03:54 +0000 (12:03 -0400)
lacked SAM header
 * Due to lack of SO tag in temp files. This tag is set just fine on
input BAMs containing SAM headers. However, when an input file lacked
one, especially the (required) VN number, the entire @HD line was
dropped.
 * Forcing the current SAM version number, if none exists, on sort
output.

CMakeLists.txt
src/api/SamConstants.h
src/toolkit/CMakeLists.txt
src/toolkit/bamtools_sort.cpp

index 8deded9166da085bb94a1726d2732a3dfaaa204d..96d34676a13cbe20e702e654622355cc54467772 100644 (file)
@@ -32,7 +32,7 @@ ensure_out_of_source_build( "
 # set BamTools version information
 set( BamTools_VERSION_MAJOR 2 )
 set( BamTools_VERSION_MINOR 1 )
-set( BamTools_VERSION_BUILD 0 )
+set( BamTools_VERSION_BUILD 1 )
 
 # set our library and executable destination dirs
 set( EXECUTABLE_OUTPUT_PATH "${CMAKE_SOURCE_DIR}/bin" )
index 405668c796814fc3f911be1217d8912ea29dc1ff..4bb7ee9b0268a392dec65ca1ee8fd64965912322 100644 (file)
@@ -2,7 +2,7 @@
 // SamConstants.h (c) 2010 Derek Barnett
 // Marth Lab, Department of Biology, Boston College
 // ---------------------------------------------------------------------------
-// Last modified: 10 October 2011 (DB)
+// Last modified: 27 March 2012 (DB)
 // ---------------------------------------------------------------------------
 // Provides constants for SAM header
 // ***************************************************************************
@@ -24,6 +24,8 @@ const char SAM_STAR   = '*';
 const char SAM_TAB    = '\t';
 const std::string SAM_DIGITS = "0123456789";
 
+const std::string SAM_CURRENT_VERSION = "1.4";
+
 // HD entries
 const std::string SAM_HD_BEGIN_TOKEN    = "@HD";
 const std::string SAM_HD_VERSION_TAG    = "VN";
index 58f3697ed780ee82a62130f82490411da0eb36c6..a88cf7952cb91494798d7c4bdf2c347706603e13 100644 (file)
@@ -31,7 +31,7 @@ add_executable( bamtools_cmd
 
 # set BamTools application properties
 set_target_properties( bamtools_cmd PROPERTIES
-                       VERSION  2.1.0
+                       VERSION  2.1.1
                        OUTPUT_NAME "bamtools"
                      )
 # make version info available in application
index 03143e18bee6b94c1cc7e3719046f40333b16372..e268bee748b7d8c726bec2a71ade943a871f7f5d 100644 (file)
@@ -2,7 +2,7 @@
 // bamtools_sort.cpp (c) 2010 Derek Barnett, Erik Garrison
 // Marth Lab, Department of Biology, Boston College
 // ---------------------------------------------------------------------------
-// Last modified: 11 October 2011 (DB)
+// Last modified: 27 March 2012 (DB)
 // ---------------------------------------------------------------------------
 // Sorts an input BAM file
 // ***************************************************************************
@@ -133,6 +133,8 @@ bool SortTool::SortToolPrivate::GenerateSortedRuns(void) {
     
     // get basic data that will be shared by all temp/output files 
     SamHeader header = reader.GetHeader();
+    if ( !header.HasVersion() )
+        header.Version = Constants::SAM_CURRENT_VERSION;
     header.SortOrder = ( m_settings->IsSortingByName
                        ? Constants::SAM_HD_SORTORDER_QUERYNAME
                        : Constants::SAM_HD_SORTORDER_COORDINATE );