+// ***************************************************************************
+// BamIndex.cpp (c) 2009 Derek Barnett
+// Marth Lab, Department of Biology, Boston College
+// All rights reserved.
+// ---------------------------------------------------------------------------
+// Last modified: 17 August 2010 (DB)
+// ---------------------------------------------------------------------------
+// Provides index functionality - both for the default (standardized) BAM
+// index format (.bai) as well as a BamTools-specific (nonstandard) index
+// format (.bti).
+// ***************************************************************************
+
#include <cstdio>
#include <cstdlib>
#include <algorithm>
-#include <iostream>
+// #include <iostream>
#include <map>
#include "BamIndex.h"
#include "BamReader.h"
namespace BamTools {
+// --------------------------------------------------
+// BamDefaultIndex data structures & typedefs
struct Chunk {
// data members
{ }
};
-typedef vector<ReferenceIndex> BamDefaultIndexData;
+typedef vector<ReferenceIndex> BamDefaultIndexData;
} // namespace BamTools
// if block is full, get offset for next block, reset currentBlockCount
if ( currentBlockCount == d->m_blockSize ) {
-// cerr << "-------------------------------" << endl;
-// cerr << "BlockCount = " << currentBlockCount << endl;
-// cerr << endl;
-// cerr << "Storing entry: " << endl;
-// cerr << "\trefID : " << blockStartId << endl;
-// cerr << "\tpos : " << blockStartPosition << endl;
-// cerr << "\toffset : " << blockStartOffset << endl;
-//
-
d->m_indexData.push_back( BamToolsIndexEntry(blockStartOffset, blockStartId, blockStartPosition) );
blockStartOffset = m_BGZF->Tell();
currentBlockCount = 0;
return false;
// store offset & return success
-/* cerr << "BTI::GetOffsets() : calculated offset = " << previousOffset << endl;*/
offsets.push_back(previousOffset);
return true;
}