Permalink
Browse files

fix failure to propagate nthreads and output batch size to relevant c…

…onstructors
  • Loading branch information...
1 parent 820eac1 commit 19066519066b4a71927aa9001091b7a3d03423d4 @BenLangmead committed Apr 16, 2017
Showing with 98 additions and 46 deletions.
  1. +53 −25 ebwt_search.cpp
  2. +27 −9 hit.h
  3. +18 −12 sam.h
View
@@ -91,6 +91,7 @@ static bool strata; // true -> don't stop at stratum boundaries
static bool refOut; // if true, alignments go to per-ref files
static int partitionSz; // output a partitioning key in first field
static int readsPerBatch; // # reads to read from input file at once
+static int outBatchSz; // # alignments to write to output file at once
static bool noMaqRound; // true -> don't round quals to nearest 10 like maq
static bool fileParallel; // separate threads read separate input files in parallel
static bool useShmem; // use shared memory to hold the index
@@ -198,6 +199,7 @@ static void resetOptions() {
refOut = false; // if true, alignments go to per-ref files
partitionSz = 0; // output a partitioning key in first field
readsPerBatch = 16; // # reads to read from input file at once
+ outBatchSz = 16; // # alignments to wrote to output file at once
noMaqRound = false; // true -> don't round quals to nearest 10 like maq
fileParallel = false; // separate threads read separate input files in parallel
useShmem = false; // use shared memory to hold the index
@@ -2598,8 +2600,6 @@ patsrcFromStrings(int format,
}
}
-#define PASS_DUMP_FILES dumpAlBase, dumpUnalBase, dumpMaxBase
-
static string argstr;
template<typename TStr>
@@ -2872,58 +2872,86 @@ static void driver(const char * type,
ebwt.nPat(), offBase,
colorSeq, colorQual, printCost,
suppressOuts, rmap, amap,
- fullRef, PASS_DUMP_FILES,
+ fullRef,
+ dumpAlBase,
+ dumpUnalBase,
+ dumpMaxBase,
format == TAB_MATE, sampleMax,
- refnames, partitionSz);
+ refnames, nthreads,
+ outBatchSz, partitionSz);
} else {
sink = new VerboseHitSink(
fout, offBase,
colorSeq, colorQual, printCost,
suppressOuts, rmap, amap,
- fullRef, PASS_DUMP_FILES,
+ fullRef,
+ dumpAlBase,
+ dumpUnalBase,
+ dumpMaxBase,
format == TAB_MATE, sampleMax,
- refnames, partitionSz);
+ refnames, nthreads,
+ outBatchSz, partitionSz);
}
break;
case OUTPUT_SAM:
if(refOut) {
throw 1;
} else {
SAMHitSink *sam = new SAMHitSink(
- fout, 1, rmap, amap,
- fullRef, samNoQnameTrunc, defaultMapq,
- PASS_DUMP_FILES,
- format == TAB_MATE, sampleMax,
- refnames, nthreads);
+ fout, 1, rmap, amap,
+ fullRef, samNoQnameTrunc,
+ dumpAlBase,
+ dumpUnalBase,
+ dumpMaxBase,
+ format == TAB_MATE,
+ sampleMax,
+ refnames,
+ nthreads,
+ outBatchSz);
if(!samNoHead) {
vector<string> refnames;
if(!samNoSQ) {
readEbwtRefnames(adjustedEbwtFileBase, refnames);
}
sam->appendHeaders(
- sam->out(0), ebwt.nPat(),
- refnames, color, samNoSQ, rmap,
- ebwt.plen(), fullRef,
- samNoQnameTrunc,
- argstr.c_str(),
- rgs.empty() ? NULL : rgs.c_str());
+ sam->out(0),
+ ebwt.nPat(),
+ refnames, color, samNoSQ, rmap,
+ ebwt.plen(), fullRef,
+ samNoQnameTrunc,
+ argstr.c_str(),
+ rgs.empty() ? NULL : rgs.c_str());
}
sink = sam;
}
break;
case OUTPUT_CONCISE:
if(refOut) {
sink = new ConciseHitSink(
- ebwt.nPat(), offBase,
- PASS_DUMP_FILES,
- format == TAB_MATE, sampleMax,
- refnames, reportOpps);
+ ebwt.nPat(),
+ offBase,
+ dumpAlBase,
+ dumpUnalBase,
+ dumpMaxBase,
+ format == TAB_MATE,
+ sampleMax,
+ refnames,
+ nthreads,
+ outBatchSz,
+ reportOpps);
} else {
sink = new ConciseHitSink(
- fout, offBase,
- PASS_DUMP_FILES,
- format == TAB_MATE, sampleMax,
- refnames, reportOpps);
+ fout,
+ offBase,
+ dumpAlBase,
+ dumpUnalBase,
+ dumpMaxBase,
+ format == TAB_MATE,
+ sampleMax,
+ refnames,
+ nthreads,
+ outBatchSz,
+ reportOpps);
}
break;
case OUTPUT_NONE:
View
36 hit.h
@@ -156,9 +156,9 @@ class HitSink {
const std::string& dumpMax,
bool onePairFile,
bool sampleMax,
- vector<string>* refnames = NULL,
- size_t nthreads = 1,
- int perThreadBufSize = 512) :
+ vector<string>* refnames,
+ size_t nthreads,
+ int perThreadBufSize) :
_outs(),
_deleteOuts(false),
_refnames(refnames),
@@ -204,7 +204,9 @@ class HitSink {
const std::string& dumpMax,
bool onePairFile,
bool sampleMax,
- vector<string>* refnames = NULL) :
+ vector<string>* refnames,
+ size_t nthreads,
+ int perThreadBufSize) :
_outs(),
_deleteOuts(true),
_refnames(refnames),
@@ -1432,6 +1434,8 @@ class ConciseHitSink : public HitSink {
bool onePairFile,
bool sampleMax,
std::vector<std::string>* refnames,
+ size_t nthreads,
+ int perThreadBufSize,
bool reportOpps = false) :
HitSink(
out,
@@ -1440,7 +1444,9 @@ class ConciseHitSink : public HitSink {
dumpMax,
onePairFile,
sampleMax,
- refnames),
+ refnames,
+ nthreads,
+ perThreadBufSize),
_reportOpps(reportOpps),
offBase_(offBase) { }
@@ -1457,6 +1463,8 @@ class ConciseHitSink : public HitSink {
bool onePairFile,
bool sampleMax,
std::vector<std::string>* refnames,
+ size_t nthreads,
+ int perThreadBufSize,
bool reportOpps = false) :
HitSink(
numOuts,
@@ -1465,7 +1473,9 @@ class ConciseHitSink : public HitSink {
dumpMax,
onePairFile,
sampleMax,
- refnames),
+ refnames,
+ nthreads,
+ perThreadBufSize),
_reportOpps(reportOpps),
offBase_(offBase) { }
@@ -1553,6 +1563,8 @@ class VerboseHitSink : public HitSink {
bool onePairFile,
bool sampleMax,
std::vector<std::string>* refnames,
+ size_t nthreads,
+ int perThreadBufSize,
int partition = 0) :
HitSink(
out,
@@ -1561,7 +1573,9 @@ class VerboseHitSink : public HitSink {
dumpMax,
onePairFile,
sampleMax,
- refnames),
+ refnames,
+ nthreads,
+ perThreadBufSize),
partition_(partition),
offBase_(offBase),
colorSeq_(colorSeq),
@@ -1592,6 +1606,8 @@ class VerboseHitSink : public HitSink {
bool onePairFile,
bool sampleMax,
std::vector<std::string>* refnames,
+ size_t nthreads,
+ int perThreadBufSize,
int partition = 0) :
HitSink(
numOuts,
@@ -1600,7 +1616,9 @@ class VerboseHitSink : public HitSink {
dumpMax,
onePairFile,
sampleMax,
- refnames),
+ refnames,
+ nthreads,
+ perThreadBufSize),
partition_(partition),
offBase_(offBase),
colorSeq_(colorSeq),
@@ -1664,7 +1682,7 @@ class VerboseHitSink : public HitSink {
*/
class StubHitSink : public HitSink {
public:
- StubHitSink() : HitSink(new OutFileBuf(".tmp"), "", "", "", false, false, NULL) { }
+ StubHitSink() : HitSink(new OutFileBuf(".tmp"), "", "", "", false, false, NULL, 1, 1) { }
virtual void append(BTString& o, const Hit& h, int mapq, int xms) { }
};
View
30 sam.h
@@ -47,14 +47,14 @@ class SAMHitSink : public HitSink {
AnnotationMap *amap,
bool fullRef,
bool noQnameTrunc,
- int defaultMapq,
const std::string& dumpAl,
const std::string& dumpUnal,
const std::string& dumpMax,
bool onePairFile,
bool sampleMax,
std::vector<std::string>* refnames,
- int nthreads) :
+ size_t nthreads,
+ int perThreadBufSize) :
HitSink(
out,
dumpAl,
@@ -63,9 +63,12 @@ class SAMHitSink : public HitSink {
onePairFile,
sampleMax,
refnames,
- nthreads),
- offBase_(offBase), defaultMapq_(defaultMapq),
- rmap_(rmap), amap_(amap), fullRef_(fullRef),
+ nthreads,
+ perThreadBufSize),
+ offBase_(offBase),
+ rmap_(rmap),
+ amap_(amap),
+ fullRef_(fullRef),
noQnameTrunc_(noQnameTrunc) { }
/**
@@ -78,23 +81,28 @@ class SAMHitSink : public HitSink {
ReferenceMap *rmap,
AnnotationMap *amap,
bool fullRef,
- int defaultMapq,
const std::string& dumpAl,
const std::string& dumpUnal,
const std::string& dumpMax,
bool onePairFile,
bool sampleMax,
- std::vector<std::string>* refnames) :
+ std::vector<std::string>* refnames,
+ size_t nthreads,
+ int perThreadBufSize) :
HitSink(
numOuts,
dumpAl,
dumpUnal,
dumpMax,
onePairFile,
sampleMax,
- refnames),
- offBase_(offBase), defaultMapq_(defaultMapq),
- rmap_(rmap), amap_(amap), fullRef_(fullRef) { }
+ refnames,
+ nthreads,
+ perThreadBufSize),
+ offBase_(offBase),
+ rmap_(rmap),
+ amap_(amap),
+ fullRef_(fullRef) { }
/**
* Append a verbose, readable hit to the output stream
@@ -151,8 +159,6 @@ class SAMHitSink : public HitSink {
int offBase_; /// Add this to reference offsets before outputting.
/// (An easy way to make things 1-based instead of
/// 0-based)
- int defaultMapq_; /// Default mapping quality to report when one is
- /// not specified
ReferenceMap *rmap_; /// mapping to reference coordinate system.
AnnotationMap *amap_; ///
bool fullRef_; /// print full reference name, not just up to whitespace

0 comments on commit 1906651

Please sign in to comment.