Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
R3
legacy
bedtools2
Commits
34f0dd71
Commit
34f0dd71
authored
Oct 09, 2014
by
Neil Kindlon
Browse files
Forgot RecordOutputMgr
parent
8cc9c0a2
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
src/utils/RecordOutputMgr/Makefile
View file @
34f0dd71
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
src/utils/RecordOutputMgr/RecordOutputMgr.cpp
View file @
34f0dd71
This diff is collapsed.
Click to expand it.
src/utils/RecordOutputMgr/RecordOutputMgr.h
View file @
34f0dd71
/*
* 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_ */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment