Package htsjdk.samtools
Class DuplicateSet
- java.lang.Object
-
- htsjdk.samtools.DuplicateSet
-
public class DuplicateSet extends Object
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
Constructors Constructor Description DuplicateSet()
Sets the duplicate flag by defaultDuplicateSet(boolean setDuplicateFlag)
DuplicateSet(boolean setDuplicateFlag, SAMRecordDuplicateComparator comparator)
DuplicateSet(SAMRecordDuplicateComparator comparator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
add(SAMRecord record)
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.List<SAMRecord>
getRecords()
Gets the list of records from this set.List<SAMRecord>
getRecords(boolean sort)
Gets the list of records from this set.SAMRecord
getRepresentative()
Gets the representative record according to the duplicate comparator.boolean
isEmpty()
int
numDuplicates()
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 Detail
-
DuplicateSet
public DuplicateSet()
Sets the duplicate flag by default
-
DuplicateSet
public DuplicateSet(boolean setDuplicateFlag)
-
DuplicateSet
public DuplicateSet(SAMRecordDuplicateComparator comparator)
-
DuplicateSet
public DuplicateSet(boolean setDuplicateFlag, SAMRecordDuplicateComparator comparator)
-
-
Method Detail
-
add
public int add(SAMRecord record)
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
public List<SAMRecord> getRecords(boolean sort)
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.
-
getRepresentative
public SAMRecord 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.
-
-