Package htsjdk.samtools
Class DuplicateSet
java.lang.Object
htsjdk.samtools.DuplicateSet
Stores a set of records that are duplicates of each other. The first records in the list of records is
considered the representative of the duplicate, and typically does not have it's duplicate flag set.
The records' duplicate flag will be set appropriately as records are added. This behavior can be
turned off.
At this time, this set does not track optical duplicates.
-
Constructor Summary
ConstructorDescriptionSets the duplicate flag by defaultDuplicateSet
(boolean setDuplicateFlag) DuplicateSet
(boolean setDuplicateFlag, SAMRecordDuplicateComparator comparator) DuplicateSet
(SAMRecordDuplicateComparator comparator) -
Method Summary
Modifier and TypeMethodDescriptionint
Adds a record to the set and returns zero if either the set is empty, or it is a duplicate of the records already in the set.Gets the list of records from this set.getRecords
(boolean sort) Gets the list of records from this set.Gets the representative record according to the duplicate comparator.boolean
isEmpty()
int
Returns the number of duplicates in this set, including the representative record.void
setDuplicateFlag
(boolean setDuplicateFlag) Controls if we should update the duplicate flag of the records in this set.int
size()
Returns the number of records in this set.
-
Constructor Details
-
DuplicateSet
public DuplicateSet()Sets the duplicate flag by default -
DuplicateSet
public DuplicateSet(boolean setDuplicateFlag) -
DuplicateSet
-
DuplicateSet
-
-
Method Details
-
add
Adds a record to the set and returns zero if either the set is empty, or it is a duplicate of the records already in the set. Otherwise, it does not add the record and returns non-zero.- Parameters:
record
- the record to add.- Returns:
- zero if the record belongs in this set, -1 in a previous set, or 1 in a subsequent set, according to the comparison order
-
getRecords
Gets the list of records from this set. Setting sort to false likely will not yield records in duplicate order within the set.- Parameters:
sort
- true if we want the records in the duplicate set sorted by duplicate order, false if we do not care about the order.
-
getRecords
Gets the list of records from this set. -
getRepresentative
Gets the representative record according to the duplicate comparator. -
size
public int size()Returns the number of records in this set. -
numDuplicates
public int numDuplicates()Returns the number of duplicates in this set, including the representative record. Does not include records that are unmapped, secondary, or supplementary. -
isEmpty
public boolean isEmpty() -
setDuplicateFlag
public void setDuplicateFlag(boolean setDuplicateFlag) Controls if we should update the duplicate flag of the records in this set.
-