Skip to content

Commit

Permalink
optimize createCluster
Browse files Browse the repository at this point in the history
  • Loading branch information
sfchen committed Dec 5, 2018
1 parent c7cd590 commit 6ceeb9a
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/gencore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,12 +295,23 @@ void Gencore::addToUnProperCluster(bam1_t* b) {
}

void Gencore::createCluster(map<int, map<int, map<int, Cluster*>>>& clusters, int tid, int left, int right) {
if(clusters.count(tid) == 0)
map<int, map<int, map<int, Cluster*>>>::iterator iter1 = clusters.find(tid);

if(iter1 == clusters.end()) {
clusters[tid] = map<int, map<int, Cluster*>>();
if(clusters[tid].count(left) == 0)
clusters[tid][left] = map<int, Cluster*>();
if(clusters[tid][left].count(right) == 0)
clusters[tid][left][right] = new Cluster(mOptions);
} else {
map<int, map<int, Cluster*>>::iterator iter2 =iter1->second.find(left);
if(iter2 == iter1->second.end()) {
clusters[tid][left] = map<int, Cluster*>();
clusters[tid][left][right] = new Cluster(mOptions);
} else {
map<int, Cluster*>::iterator iter3 = iter2->second.find(right);
if(iter3 == iter2->second.end())
clusters[tid][left][right] = new Cluster(mOptions);
}
}
}

void Gencore::addToCluster(bam1_t* b) {
Expand Down

0 comments on commit 6ceeb9a

Please sign in to comment.