Skip to content
Snippets Groups Projects
Commit 34f0dd71 authored by Neil Kindlon's avatar Neil Kindlon
Browse files

Forgot RecordOutputMgr

parent 8cc9c0a2
No related branches found
No related tags found
No related merge requests found
OBJ_DIR = ../../../obj/
BIN_DIR = ../../../bin/
UTILITIES_DIR = ../../utils/
# -------------------
# define our includes
# -------------------
INCLUDES = -I$(UTILITIES_DIR)/general/ \
-I$(UTILITIES_DIR)/fileType/ \
-I$(UTILITIES_DIR)/Contexts/ \
-I$(UTILITIES_DIR)/GenomeFile/ \
-I$(UTILITIES_DIR)/FileRecordTools/ \
-I$(UTILITIES_DIR)/FileRecordTools/FileReaders/ \
-I$(UTILITIES_DIR)/FileRecordTools/Records/ \
-I$(UTILITIES_DIR)/KeyListOps/ \
-I$(UTILITIES_DIR)/BamTools/include \
-I$(UTILITIES_DIR)/BamTools/src/ \
-I$(UTILITIES_DIR)/version/
# ----------------------------------
# define our source and object files
# ----------------------------------
SOURCES= RecordOutputMgr.cpp RecordOutputMgr.h
OBJECTS= RecordOutputMgr.o
_EXT_OBJECTS=
EXT_OBJECTS=$(patsubst %,$(OBJ_DIR)/%,$(_EXT_OBJECTS))
BUILT_OBJECTS= $(patsubst %,$(OBJ_DIR)/%,$(OBJECTS))
$(BUILT_OBJECTS): $(SOURCES)
@echo " * compiling" $(*F).cpp
@$(CXX) -c -o $@ $(*F).cpp $(LDFLAGS) $(CXXFLAGS) $(INCLUDES)
$(EXT_OBJECTS):
@$(MAKE) --no-print-directory -C $(INCLUDES)
clean:
@echo "Cleaning up."
@rm -f $(OBJ_DIR)/RecordOutputMgr.o
OBJ_DIR = ../../../obj/
BIN_DIR = ../../../bin/
UTILITIES_DIR = ../../utils/
# -------------------
# define our includes
# -------------------
INCLUDES = -I$(UTILITIES_DIR)/general/ \
-I$(UTILITIES_DIR)/fileType/ \
-I$(UTILITIES_DIR)/Contexts/ \
-I$(UTILITIES_DIR)/GenomeFile/ \
-I$(UTILITIES_DIR)/FileRecordTools/ \
-I$(UTILITIES_DIR)/FileRecordTools/FileReaders/ \
-I$(UTILITIES_DIR)/FileRecordTools/Records/ \
-I$(UTILITIES_DIR)/KeyListOps/ \
-I$(UTILITIES_DIR)/BamTools/include \
-I$(UTILITIES_DIR)/BamTools/src/ \
-I$(UTILITIES_DIR)/version/
# ----------------------------------
# define our source and object files
# ----------------------------------
SOURCES= RecordOutputMgr.cpp RecordOutputMgr.h
OBJECTS= RecordOutputMgr.o
_EXT_OBJECTS=
EXT_OBJECTS=$(patsubst %,$(OBJ_DIR)/%,$(_EXT_OBJECTS))
BUILT_OBJECTS= $(patsubst %,$(OBJ_DIR)/%,$(OBJECTS))
$(BUILT_OBJECTS): $(SOURCES)
@echo " * compiling" $(*F).cpp
@$(CXX) -c -o $@ $(*F).cpp $(LDFLAGS) $(CXXFLAGS) $(INCLUDES)
$(EXT_OBJECTS):
@$(MAKE) --no-print-directory -C $(INCLUDES)
clean:
@echo "Cleaning up."
@rm -f $(OBJ_DIR)/RecordOutputMgr.o
.PHONY: clean
\ No newline at end of file
This diff is collapsed.
/*
* RecordOutputMgr.h
*
* Created on: May 28, 2013
* Author: nek3d
*/
#ifndef RECORDOUTPUTMGR_H_
#define RECORDOUTPUTMGR_H_
using namespace std;
#include "ContextBase.h"
#include "RecordKeyVector.h"
#include "api/BamWriter.h"
class BlockMgr;
class RecordOutputMgr {
public:
RecordOutputMgr();
~RecordOutputMgr();
//The init method must be called after all the input files are open.
void init(ContextBase *context);
void printRecord(const Record *record);
void printRecord(RecordKeyVector &keyList);
void printRecord(const Record *record, const QuickString & value);
//where necessary, pass additional information about splits through the blockMgr.
void setSplitInfo(const BlockMgr *blockMgr) { _splitInfo = blockMgr; }
private:
typedef enum { NOT_BAM, BAM_AS_BAM, BAM_AS_BED} printBamType;
ContextBase *_context;
bool _printable;
BamTools::BamWriter *_bamWriter;
RecordKeyVector *_currBamBlockList;
QuickString _outBuf;
//
BlockMgr *_bamBlockMgr;
const BlockMgr *_splitInfo;
QuickString _afterVal; //to store values to be printed after record, such as column operations.
//some helper functions to neaten the code.
void tab() { _outBuf.append('\t'); }
void newline() { _outBuf.append('\n'); }
void null(bool queryType, bool dbType);
void printRecord(RecordKeyVector &keyList, RecordKeyVector *blockList);
void printKey(const Record *key);
void printKey(const Record *key, const QuickString & start, const QuickString & end);
void addDbFileId(int fileId);
bool printKeyAndTerminate(RecordKeyVector &keyList);
printBamType printBamRecord(RecordKeyVector &keyList, bool bamOutputOnly = false);
void checkForHeader();
void reportOverlapDetail(const Record *keyRecord, const Record *hitRecord, int hitIdx = 0);
void reportOverlapSummary(RecordKeyVector &keyList);
static const unsigned int MAX_OUTBUF_SIZE = 16384; //16 K
// If we are using buffered output, only flush the output buffer if it's least
// 90% full. If we're not using buffered output, flush if it's not empty
bool needsFlush() const {
return ((_context->getUseBufferedOutput() &&_outBuf.size() >= MAX_OUTBUF_SIZE *.9) ||
(!_context->getUseBufferedOutput() && !_outBuf.empty()));
}
void flush();
};
#endif /* RECORDOUTPUTMGR_H_ */
/*
* RecordOutputMgr.h
*
* Created on: May 28, 2013
* Author: nek3d
*/
#ifndef RECORDOUTPUTMGR_H_
#define RECORDOUTPUTMGR_H_
using namespace std;
#include "ContextBase.h"
#include "RecordKeyVector.h"
#include "api/BamWriter.h"
class BlockMgr;
class RecordOutputMgr {
public:
RecordOutputMgr();
~RecordOutputMgr();
//The init method must be called after all the input files are open.
void init(ContextBase *context);
void printRecord(const Record *record);
void printRecord(RecordKeyVector &keyList);
void printRecord(const Record *record, const QuickString & value);
void printClosest(RecordKeyVector &keyList, const vector<int> *dists = NULL);
//where necessary, pass additional information about splits through the blockMgr.
void setSplitInfo(const BlockMgr *blockMgr) { _splitInfo = blockMgr; }
private:
typedef enum { NOT_BAM, BAM_AS_BAM, BAM_AS_BED} printBamType;
ContextBase *_context;
bool _printable;
BamTools::BamWriter *_bamWriter;
RecordKeyVector *_currBamBlockList;
QuickString _outBuf;
//
BlockMgr *_bamBlockMgr;
const BlockMgr *_splitInfo;
QuickString _afterVal; //to store values to be printed after record, such as column operations.
//some helper functions to neaten the code.
void tab() { _outBuf.append('\t'); }
void newline() { _outBuf.append('\n'); }
void null(bool queryType, bool dbType);
void printRecord(RecordKeyVector &keyList, RecordKeyVector *blockList);
void printKey(const Record *key);
void printKey(const Record *key, const QuickString & start, const QuickString & end);
void addDbFileId(int fileId);
bool printKeyAndTerminate(RecordKeyVector &keyList);
printBamType printBamRecord(RecordKeyVector &keyList, bool bamOutputOnly = false);
void checkForHeader();
void reportOverlapDetail(const Record *keyRecord, const Record *hitRecord, int hitIdx = 0);
void reportOverlapSummary(RecordKeyVector &keyList);
static const unsigned int MAX_OUTBUF_SIZE = 16384; //16 K
// If we are using buffered output, only flush the output buffer if it's least
// 90% full. If we're not using buffered output, flush if it's not empty
bool needsFlush() const {
return ((_context->getUseBufferedOutput() &&_outBuf.size() >= MAX_OUTBUF_SIZE *.9) ||
(!_context->getUseBufferedOutput() && !_outBuf.empty()));
}
void flush();
};
#endif /* RECORDOUTPUTMGR_H_ */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment