Skip to content
Snippets Groups Projects
Commit ade40fc1 authored by Aaron's avatar Aaron
Browse files

Fixed bug preventing proper clustering. max(end) was not being updated.

parent fbdd520f
No related branches found
No related tags found
No related merge requests found
......@@ -22,7 +22,6 @@ BedCluster::BedCluster(string &bedFile,
_maxDistance(maxDistance)
{
_bed = new BedFile(bedFile);
if (_forceStrand == false)
ClusterBed();
else
......@@ -46,6 +45,7 @@ void BedCluster::ClusterBed() {
while (_bed->GetNextBed(curr, true)) { // true = force sorted intervals
if (_bed->_status != BED_VALID)
continue;
// new cluster, no overlap
if ( (((int) curr.start - end) > _maxDistance) ||
(curr.chrom != prev.chrom)
......@@ -54,6 +54,10 @@ void BedCluster::ClusterBed() {
cluster_id++;
end = curr.end;
}
else {
if ((int) curr.end > end)
end = curr.end;
}
prev = curr;
_bed->reportBedTab(curr);
printf("%d\n", cluster_id);
......
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