Package htsjdk.samtools
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.
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.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Client must implement this class, which defines the way in which records are written to and read from file. -
Constructor Summary
ConstructorDescriptionCoordinateSortedPairInfoMap
(int maxOpenFiles, CoordinateSortedPairInfoMap.Codec<KEY, REC> elementCodec) -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
CoordinateSortedPairInfoMap
public CoordinateSortedPairInfoMap(int maxOpenFiles, CoordinateSortedPairInfoMap.Codec<KEY, REC> elementCodec)
-
-
Method Details
-
remove
- Parameters:
sequenceIndex
-key
-- Returns:
- The record corresponding to the given sequenceIndex and key, or null if it is not present.
-
put
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
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.
-