BackgroundRegionManager::computePandFlush() is erroneously calling SiteManager::getFDRvalsAndWriteAndFlush() at the end. This causes erroneous termination of hotspot2 with an error message when there are some valid sites followed by a large gap of unmappable territory near the start of chr1 (or near the start of any chromosome when hotspot2 is run in parallel on one chromosome at a time). Simple fix: This call needs to be moved to the end of parseAndProcessInput().
While at it, PvalueManager::computeFDRvals() is erroneously getting called twice every time SiteManager::getFDRvalsAndWriteAndFlush() is getting called. The direct calls were moved inside SiteManager::getFDRvalsAndWriteAndFlush(), and should've been deleted at that time.
BackgroundRegionManager::computePandFlush() is erroneously calling SiteManager::getFDRvalsAndWriteAndFlush() at the end. This causes erroneous termination of hotspot2 with an error message when there are some valid sites followed by a large gap of unmappable territory near the start of chr1 (or near the start of any chromosome when hotspot2 is run in parallel on one chromosome at a time). Simple fix: This call needs to be moved to the end of parseAndProcessInput().
While at it, PvalueManager::computeFDRvals() is erroneously getting called twice every time SiteManager::getFDRvalsAndWriteAndFlush() is getting called. The direct calls were moved inside SiteManager::getFDRvalsAndWriteAndFlush(), and should've been deleted at that time.