From: derek Date: Tue, 27 Mar 2012 16:03:54 +0000 (-0400) Subject: Fixed: sorting order lost during merge step of sort tool, if input BAM X-Git-Url: https://git.donarmstrong.com/?p=bamtools.git;a=commitdiff_plain;h=76bb08a359f3974eee3e96327b965ccf7958ed1a Fixed: sorting order lost during merge step of sort tool, if input BAM 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. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 8deded9..96d3467 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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" ) diff --git a/src/api/SamConstants.h b/src/api/SamConstants.h index 405668c..4bb7ee9 100644 --- a/src/api/SamConstants.h +++ b/src/api/SamConstants.h @@ -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"; diff --git a/src/toolkit/CMakeLists.txt b/src/toolkit/CMakeLists.txt index 58f3697..a88cf79 100644 --- a/src/toolkit/CMakeLists.txt +++ b/src/toolkit/CMakeLists.txt @@ -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 diff --git a/src/toolkit/bamtools_sort.cpp b/src/toolkit/bamtools_sort.cpp index 03143e1..e268bee 100644 --- a/src/toolkit/bamtools_sort.cpp +++ b/src/toolkit/bamtools_sort.cpp @@ -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 );