# create main BamTools API shared library
add_library( BamTools SHARED ${BamToolsAPISources} )
-set_target_properties( BamTools PROPERTIES SOVERSION "0.9.2" )
+set_target_properties( BamTools PROPERTIES SOVERSION "0.9.3" )
set_target_properties( BamTools PROPERTIES OUTPUT_NAME "bamtools" )
# create main BamTools API static library
Comments.clear();
}
+void SamHeader::SetHeaderText(const std::string& headerText) {
+
+ // clear prior data
+ Clear();
+
+ // parse header text into data
+ SamFormatParser parser(*this);
+ parser.Parse(headerText);
+}
+
// retrieve the SAM header, with any local modifications
string SamHeader::ToString(void) const {
SamFormatPrinter printer(*this);
// Marth Lab, Department of Biology, Boston College
// All rights reserved.
// ---------------------------------------------------------------------------
-// Last modified: 23 December 2010 (DB)
+// Last modified: 12 January 2011 (DB)
// ---------------------------------------------------------------------------
// Provides functionality for querying/manipulating SAM header data
// **************************************************************************
// otherwise, output is suppressed and only validation check occurs
bool IsValid(bool verbose = false) const;
+ // replaces SamHeader contents with headerText
+ void SetHeaderText(const std::string& headerText);
+
// retrieves the printable, SAM-formatted header
// (with any local modifications since construction)
std::string ToString(void) const;
// ctor
BamHeaderPrivate(void)
- : m_samHeader(0)
+ : m_samHeader(new SamHeader(""))
{ }
+ // dtor
+ ~BamHeaderPrivate(void) {
+ delete m_samHeader;
+ m_samHeader = 0;
+ }
+
// 'public' interface
bool Load(BgzfData* stream);
const unsigned bytesRead = stream->Read(headerText, length);
const bool readOk = ( bytesRead == length );
if ( readOk )
- m_samHeader = new SamHeader( (string)((const char*)headerText) );
+ m_samHeader->SetHeaderText( (string)((const char*)headerText) );
else
fprintf(stderr, "BAM header error - could not read header text\n");
}
void BamHeader::Clear(void) {
- delete d->m_samHeader;
- d->m_samHeader = new SamHeader("");
+ d->m_samHeader->Clear();
}
bool BamHeader::IsValid(void) const {
+// ***************************************************************************
+// SamHeaderVersion.h (c) 2010 Derek Barnett
+// Marth Lab, Department of Biology, Boston College
+// All rights reserved.
+// ---------------------------------------------------------------------------
+// Last modified: 23 December 2010 (DB)
+// ---------------------------------------------------------------------------
+// Provides functionality for comparing SAM header versions
+// *************************************************************************
+
#ifndef SAM_HEADERVERSION_P_H
#define SAM_HEADERVERSION_P_H
+// -------------
+// W A R N I N G
+// -------------
+//
+// This file is not part of the BamTools API. It exists purely as an
+// implementation detail. This header file may change from version to version
+// without notice, or even be removed.
+//
+// We mean it.
+
#include <api/SamConstants.h>
#include <sstream>
#include <string>