Class CoordinateSortedPairInfoMap<KEY,REC>

java.lang.Object
htsjdk.samtools.CoordinateSortedPairInfoMap<KEY,REC>
Type Parameters:
KEY - KEY + reference sequence index are used to identify the record being stored or retrieved.
REC - The type of record being retrieved.
All Implemented Interfaces:
Iterable<Map.Entry<KEY,REC>>

public class CoordinateSortedPairInfoMap<KEY,REC> extends Object implements Iterable<Map.Entry<KEY,REC>>
Holds info about a mate pair for use when processing a coordinate sorted file. When one read of a pair is encountered, the caller should add a record to this map. When the other read of a pair is encountered, the record should be removed. This class assumes that reads will be processed in order of reference sequence index. When the map is queried for a record for a given reference sequence index, all the records for that sequence are loaded from temp file into RAM, so there must be sufficient RAM to hold all the records for one reference sequence. If the records are not processed in reference sequence order, loading and unloading of records will cause performance to be terrible.
  • Constructor Details

  • Method Details

    • remove

      public REC remove(int sequenceIndex, KEY key)
      Parameters:
      sequenceIndex -
      key -
      Returns:
      The record corresponding to the given sequenceIndex and key, or null if it is not present.
    • put

      public void put(int sequenceIndex, KEY key, REC record)
      Store the record with the given sequence index and key. It is assumed that value did not previously exist in the map, and an exception is thrown (possibly at a later time) if that is not the case.
      Parameters:
      sequenceIndex -
      key -
      record -
    • size

      public int size()
    • sizeInRam

      public int sizeInRam()
      Returns:
      number of elements stored in RAM. Always <= size()
    • iterator

      public CloseableIterator<Map.Entry<KEY,REC>> iterator()
      Creates an iterator over all elements in map, in arbitrary order. Elements may not be added or removed from map when iteration is in progress, nor may a second iteration be started. Iterator must be closed in order to allow normal access to the map.
      Specified by:
      iterator in interface Iterable<KEY>