broadinstitute/IGV — pull request #7 by jsilter (2012-07-18 20:46:30+00:00)
Title: Caching2

Add caching to FeatureTrack.

The same caching mechanism is used as in AlignmentDataManager, that has been moved to the new CachedIntervals class. This class stores Interval objects as a map from chromosome names -> list of Intervals. The interface Interval is implemented by PackedFeatures and AlignmentInterval, essentially it is a set of data with a chr, start, end, with the ability to merge in another Interval of the same type and also trim down. The merge capability is so we can add data incrementally, the trim capability is to prevent the cache from getting too big.

CachedIntervals has parameters for maximum number of intervals to be stored, and the maximum size of each interval. When new data is added, it is either added to the list or merged in, depending on if there is overlap. Old Intervals are trimmed or dropped completely as appropriate based on the maximum sizes.