Skip to content

Commit

Permalink
Small improvements to reorder algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
Rone committed Jul 10, 2020
1 parent a41995d commit b58c1e3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
3 changes: 1 addition & 2 deletions hit.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,8 @@ class HitSink {
}
}
ptCounts_[threadId]++;
size_t batchId = (size_t)(p.rdid()/perThreadBufSize_);
if (reorder_ && reorderInfo_[threadId].flushed) {
reorderInfo_[threadId].batchId = batchId;
reorderInfo_[threadId].batchId = p.batch_id();
reorderInfo_[threadId].flushed = false;
}
maybeFlush(threadId);
Expand Down
7 changes: 6 additions & 1 deletion pat.h
Original file line number Diff line number Diff line change
Expand Up @@ -962,7 +962,8 @@ class PatternSourcePerThread {
last_batch_(false),
last_batch_size_(0),
skip_(skip),
seed_(seed) { }
seed_(seed),
batch_id_(0) { }

/**
* Get the next paired or unpaired read from the wrapped
Expand All @@ -980,6 +981,8 @@ class PatternSourcePerThread {

TReadId rdid() const { return buf_.rdid(); }

size_t batch_id() const { return batch_id_; }

/**
* Return true iff the read currently in the buffer is a
* paired-end read.
Expand All @@ -1002,6 +1005,7 @@ class PatternSourcePerThread {
buf_.reset();
std::pair<bool, int> res = composer_.nextBatch(buf_);
buf_.init();
batch_id_ = (size_t)(buf_.rdid()/buf_.max_buf_);
return res;
}

Expand Down Expand Up @@ -1033,6 +1037,7 @@ class PatternSourcePerThread {
size_t last_batch_size_; // # reads read in previous batch
uint32_t skip_; // skip reads with rdids less than this
uint32_t seed_; // pseudo-random seed based on read content
size_t batch_id_; // identify batches of reads for reordering
};

/**
Expand Down
3 changes: 1 addition & 2 deletions sam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,8 @@ void SAMHitSink::reportUnOrMax(
o << '\n';
}
ptCounts_[threadId]++;
size_t batchId = (size_t)(p.rdid()/perThreadBufSize_);
if (reorder_ && reorderInfo_[threadId].flushed) {
reorderInfo_[threadId].batchId = batchId;
reorderInfo_[threadId].batchId = p.batch_id();
reorderInfo_[threadId].flushed = false;
}
maybeFlush(threadId);
Expand Down

0 comments on commit b58c1e3

Please sign in to comment.